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.
精彩评论