lib/sequel/adapters/extralite.rb in extralite-1.14 vs lib/sequel/adapters/extralite.rb in extralite-1.15
- old
+ new
@@ -120,21 +120,21 @@
# db.extended_result_codes = true
# end
connection_pragmas.each{|s| log_connection_yield(s, db){db.query(s)}}
- # class << db
- # attr_reader :prepared_statements
- # end
- # db.instance_variable_set(:@prepared_statements, {})
+ class << db
+ attr_reader :prepared_statements
+ end
+ db.instance_variable_set(:@prepared_statements, {})
db
end
# Disconnect given connections from the database.
def disconnect_connection(c)
- # c.prepared_statements.each_value{|v| v.first.close}
+ c.prepared_statements.each_value{|v| v.first.close }
c.close
end
# Run the given SQL with the given arguments and yield each row.
def execute(sql, opts=OPTS, &block)
@@ -147,17 +147,17 @@
end
# Drop any prepared statements on the connection when executing DDL. This is because
# prepared statements lock the table in such a way that you can't drop or alter the
# table while a prepared statement that references it still exists.
- # def execute_ddl(sql, opts=OPTS)
- # synchronize(opts[:server]) do |conn|
- # conn.prepared_statements.values.each{|cps, s| cps.close}
- # conn.prepared_statements.clear
- # super
- # end
- # end
+ def execute_ddl(sql, opts=OPTS)
+ synchronize(opts[:server]) do |conn|
+ conn.prepared_statements.values.each{|cps, s| cps.close}
+ conn.prepared_statements.clear
+ super
+ end
+ end
def execute_insert(sql, opts=OPTS)
_execute(:insert, sql, opts)
end
@@ -191,10 +191,10 @@
# Yield an available connection. Rescue any Extralite::Error and turn
# them into DatabaseErrors.
def _execute(type, sql, opts, &block)
begin
synchronize(opts[:server]) do |conn|
- # return execute_prepared_statement(conn, type, sql, opts, &block) if sql.is_a?(Symbol)
+ return execute_prepared_statement(conn, type, sql, opts, &block) if sql.is_a?(Symbol)
log_args = opts[:arguments]
args = {}
opts.fetch(:arguments, OPTS).each{|k, v| args[k] = prepared_statement_argument(v) }
case type
when :select