Legacy database on remote host


#1

I’m getting this error in webrick then it crashes leaving nothing in the
log.

ruby: symbol lookup error:
/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:
mysql_sqlstate

Here is the standard query I would normally write to get the data.

select * from child,parent
where CONCAT(SUBSTRING(child.item_number,1,14,‘00’) =
parent.order_number and parent.order_number = ‘4444444444444400’

Here are my models and my database.yml

class Parent < ActiveRecord::Base
set_table_name :parent
set_primary_key :order_number
has_many :child,
:class_name =>
‘AppName’,
:finder_sql =>
“select child.* from child,parent " +
"
where CONCAT(SUBSTRING(child.item_number,1,14,‘00’) =
parent.order_number”
end
class Child < ActiveRecord::Base
set_table_name :child
set_primary_key :item_number
belongs_to :parent,
:foreign_key =>
‘order_number’,
:class_name
=> BeeOrder
end

development:
adapter: mysql
database: legacy_test
username: john
password: doe

socket: /var/lib/mysql/mysql.sock

host: my_host
port: 3306

I"ve been pulling my hair out for a week trying to get this legacy
database working! Please help!


#2

This is the correct model name, in my hast to change the names before I
posted I forgot to change this one. Can anyone help?

Here are my models and my database.yml

class Parent < ActiveRecord::Base
set_table_name :parent
set_primary_key :order_number
has_many :child,
:class_name =>
‘Child’,
:finder_sql =>
"select child.* from child,parent " +
"
where CONCAT(SUBSTRING(child.item_number,1,14,‘00’) =

Here are my models and my database.yml

class Parent < ActiveRecord::Base
set_table_name :parent
set_primary_key :order_number
has_many :child,
:class_name =>
‘AppName’,
:finder_sql =>
"select child.* from child,parent " +
"
where CONCAT(SUBSTRING(child.item_number,1,14,‘00’) =


#3

…,1,14 ) , ‘00’) = …
missing ‘)’ perhaps?


#4

Thank you, but I fixed that but I still get the same error.

Rob B. wrote:

…,1,14 ) , ‘00’) = …
missing ‘)’ perhaps?