How do you manually execute SQL commands in Ruby On Rails using NuoDB

前端 未结 4 1917
醉梦人生
醉梦人生 2020-12-22 19:38

I\'m trying to manually execute SQL commands so I can access procedures in NuoDB.

I\'m using Ruby on Rails and I\'m using the following command:

Acti         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 20:03

    res = ActiveRecord::Base.connection_pool.with_connection { |con| con.exec_query( "SELECT 1;" ) }
    

    The above code is an example for

    1. executing arbitrary SQL on your database-connection
    2. returning the connection back to the connection pool afterwards

提交回复
热议问题