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 -- Posted via http://www.ruby-forum.com/.
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.. -- Posted with http://DevLists.com. Sign up and save your time!
no. any idea? Richard Williams 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..-- Posted via http://www.ruby-forum.com/.
sorry richard. i think you are right. and i find a link: http://railsmanual.org/module/ActiveRecord::ConnectionAdapters::SchemaStatements#meth_create_table cheers. Richard Williams 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..-- Posted via http://www.ruby-forum.com/.