Method: SqlPostgres::Connection#exec
- Defined in:
- lib/sqlpostgres/Connection.rb
#exec(statement) ⇒ Object
Send an SQL statement to the backend. Returns a PGResult. This is just a thin wrapper around PGConn.exec, and exists for when you want to do some SQL that Insert, Update, Select, or Transaction won’t do for you (ie, “create temporary table”).
If a PGError exception occurs and statement_in_exception is true, then statement is added to the exception.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/sqlpostgres/Connection.rb', line 134 def exec(statement) begin @pgconn.exec(statement) rescue PGError => e if statement_in_exception e = e.exception(e. + "The offending statement is: #{statement.inspect}") end raise e end end |