module Sequel::JDBC::SQLite::DatabaseMethods
Instance methods for SQLite Database objects accessed via JDBC.
Constants
- DATABASE_ERROR_REGEXPS
- FOREIGN_KEY_ERROR_RE
- LAST_INSERT_ROWID
Public Instance Methods
foreign_key_list(table, opts={})
click to toggle source
Swallow pointless exceptions when the foreign key list pragma doesn't return any rows.
Calls superclass method
Sequel::SQLite::DatabaseMethods#foreign_key_list
# File lib/sequel/adapters/jdbc/sqlite.rb, line 16 def foreign_key_list(table, opts={}) super rescue Sequel::DatabaseError => e raise unless e.message =~ FOREIGN_KEY_ERROR_RE [] end
indexes(table, opts={})
click to toggle source
Swallow pointless exceptions when the index list pragma doesn't return any rows.
Calls superclass method
Sequel::SQLite::DatabaseMethods#indexes
# File lib/sequel/adapters/jdbc/sqlite.rb, line 25 def indexes(table, opts={}) super rescue Sequel::DatabaseError => e raise unless e.message =~ FOREIGN_KEY_ERROR_RE {} end
Private Instance Methods
connection_pool_default_options()
click to toggle source
Default to a single connection for a memory database.
Calls superclass method
# File lib/sequel/adapters/jdbc/sqlite.rb, line 49 def connection_pool_default_options o = super uri == 'jdbc:sqlite::memory:' ? o.merge(:max_connections=>1) : o end
database_error_regexps()
click to toggle source
# File lib/sequel/adapters/jdbc/sqlite.rb, line 35 def database_error_regexps DATABASE_ERROR_REGEXPS end
last_insert_id(conn, opts={})
click to toggle source
Use last_insert_rowid() to get the last inserted id.
# File lib/sequel/adapters/jdbc/sqlite.rb, line 40 def last_insert_id(conn, opts={}) statement(conn) do |stmt| rs = stmt.executeQuery(LAST_INSERT_ROWID) rs.next rs.getInt(1) end end
setup_connection(conn)
click to toggle source
Execute the connection pragmas on the connection.
Calls superclass method
# File lib/sequel/adapters/jdbc/sqlite.rb, line 55 def setup_connection(conn) conn = super(conn) statement(conn) do |stmt| connection_pragmas.each{|s| log_yield(s){stmt.execute(s)}} end conn end