开发者

Ruby ActiveRecord::Base queries adding backticks; need to remove

I am a noob; got handed this project with no knowledge of Ruby/RoR or access to the original person who created it.

Anyway, my ActiveRecord::Base implementation is inserting backticks into the query string sent to Oracle giving me an invalid character error. I am not sure what to do to remove them.

Code:

class QCTestCycle < ActiveRecord::Base
    set_primary_key "TC_TESTCYCL_ID"
end

QCTestCycle.establish_connection(@qc_db[@environment_name])
QCTestCycle.set_table_name "#{@application.qc_table_name}.TESTCYCL"

unique_tests = QCTestCycle.select("tc_testcycl_id").where(:tc_cycle_id
=> @application.qc_cycle_id).group("tc_testcycl_id").all

Error:

ActiveRecord::StatementInvalid: OCIError: ORA-00911: invalid charac开发者_JAVA百科ter: SELECT tc_testcycl_id FROM `ONLINE_OLS3_DB`.`TESTCYCL` WHERE `ONLINE_OLS3_DB`.`TESTCYCL`.`tc_cycle_id` = 463 GROUP BY tc_testcycl_id

Any help on removing the backticks would be greatly appreciated.


Brian's question about #establish_connection led me to realize the issue here was that my script was issuing mySQL syntax for an Oracle DB. SO the answer is change the driver... now I need to learn how to do that. Many thanks Brian.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜