Sha256: f1fb52bdadb64a0b1b4e6369f855c08f41a1e95bb87c1dfad048c670dea9cb81
Contents?: true
Size: 488 Bytes
Versions: 1
Compression:
Stored size: 488 Bytes
Contents
module ActiveRecordPgStuff module Connection module TemporaryTable def with_temporary_table(name, sql, &block) transaction do begin sql = sql.gsub(/\n/, ' ').gsub(/ +/, ' ').strip sql = "CREATE TEMPORARY TABLE #{name} ON COMMIT DROP AS #{sql}" conn.execute sql yield name ensure execute("DROP TABLE IF EXISTS #{name}") rescue nil end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord_pg_stuff-0.0.1 | lib/activerecord_pg_stuff/connection/temporary_table.rb |