Forum: Ruby on Rails multi-sql problem?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joe B. (Guest)
on 2006-02-19 15:42
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
Richard W. (Guest)
on 2006-02-19 19:20
(Received via mailing list)
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..
Joe B. (Guest)
on 2006-02-20 06:10
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..
Joe B. (Guest)
on 2006-02-20 07:38
sorry richard. i think you are right.
and i find a link:

http://railsmanual.org/module/ActiveRecord::Connec...
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..
This topic is locked and can not be replied to.