Multi-sql problem?


#1

hi all,
how to excute multi sql statement in rails

#-------------------------------------------------------
sql_1 = ‘drop table if exists test’

sql_2 = ‘create temporary table test select * from test_1’

sql_3=‘select * from test’

#-------------------------------------------------------

any ideas

all regards


#2

I think you can do it this way - - Haven’t done this myself.

Look here:

http://rubyonrails.com/rails/

In the Methods list find the “drop_table”, “create_table” methods. I
believe you use this like:

result = Abc.connection.drop_table(…)

Where Abc is your defined database (defined in your config/database.yml)

etc…


#3

no. any idea?

Richard W. wrote:

I think you can do it this way - - Haven’t done this myself.

Look here:

http://rubyonrails.com/rails/

In the Methods list find the “drop_table”, “create_table” methods. I
believe you use this like:

result = Abc.connection.drop_table(…)

Where Abc is your defined database (defined in your config/database.yml)

etc…


#4

sorry richard. i think you are right.
and i find a link:

http://railsmanual.org/module/ActiveRecord::ConnectionAdapters::SchemaStatements#meth_create_table
cheers.

Richard W. wrote:

I think you can do it this way - - Haven’t done this myself.

Look here:

http://rubyonrails.com/rails/

In the Methods list find the “drop_table”, “create_table” methods. I
believe you use this like:

result = Abc.connection.drop_table(…)

Where Abc is your defined database (defined in your config/database.yml)

etc…