Module: SQLite3

Defined in:
lib/sqlite3.rb,
lib/sqlite3/value.rb,
lib/sqlite3/errors.rb,
lib/sqlite3/pragmas.rb,
lib/sqlite3/version.rb,
lib/sqlite3/database.rb,
lib/sqlite3/constants.rb,
lib/sqlite3/ffi/c_api.rb,
lib/sqlite3/ffi/utils.rb,
lib/sqlite3/resultset.rb,
lib/sqlite3/statement.rb,
lib/sqlite3/ffi/backup.rb,
lib/sqlite3/ffi/sqlite3.rb,
lib/sqlite3/ffi/version.rb,
lib/sqlite3/fork_safety.rb,
lib/sqlite3/ffi/core_ext.rb,
lib/sqlite3/ffi/database.rb,
lib/sqlite3/version_info.rb,
lib/sqlite3/ffi/exception.rb,
lib/sqlite3/ffi/functions.rb,
lib/sqlite3/ffi/statement.rb,
lib/sqlite3/ffi/aggregator.rb

Defined Under Namespace

Modules: Constants, FFI, ForkSafety, Pragmas Classes: AbortException, AuthorizationException, Backup, Blob, BusyException, CantOpenException, ConstraintException, CorruptException, Database, EmptyException, Exception, FormatException, FullException, HashResultSet, IOException, InternalException, InterruptException, LockedException, MemoryException, MismatchException, MisuseException, NotADatabaseException, NotFoundException, PermissionException, ProtocolException, RangeException, ReadOnlyException, ResultSet, SQLException, SchemaChangedException, Statement, TooBigException, UnsupportedException, Value

Constant Summary collapse

VERSION =

(String) the version of the sqlite3 gem, e.g. “2.1.1”

"2.7.0"
SQLITE_VERSION =
FFI::CApi.sqlite3_libversion
SQLITE_VERSION_NUMBER =
FFI::CApi.sqlite3_libversion_number
SQLITE_LOADED_VERSION =
FFI::CApi.sqlite3_libversion
SQLITE_PACKAGED_LIBRARIES =
false
SQLITE_PRECOMPILED_LIBRARIES =
false
VERSION_INFO =

a hash of descriptive metadata about the current version of the sqlite3 gem

{
  ruby: RUBY_DESCRIPTION,
  gem: {
    version: SQLite3::VERSION
  },
  sqlite: {
    compiled: SQLite3::SQLITE_VERSION,
    loaded: SQLite3::SQLITE_LOADED_VERSION,
    packaged: SQLite3::SQLITE_PACKAGED_LIBRARIES,
    precompiled: SQLite3::SQLITE_PRECOMPILED_LIBRARIES,
    sqlcipher: SQLite3.sqlcipher?,
    threadsafe: SQLite3.threadsafe?
  }
}

Class Method Summary collapse

Class Method Details

.libversionObject



39
40
41
# File 'lib/sqlite3/ffi/sqlite3.rb', line 39

def self.libversion
  FFI::CApi.sqlite3_libversion
end

.sqlcipher?Boolean

Returns:



35
36
37
# File 'lib/sqlite3/ffi/sqlite3.rb', line 35

def self.sqlcipher?
  false
end

.status(parameter, reset_flag = false) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/sqlite3/ffi/sqlite3.rb', line 43

def self.status(parameter, reset_flag = false)
  op = parameter.to_i
  reset = reset_flag ? 1 : 0

  p_current = ::FFI::MemoryPointer.new(:int64)
  p_highwater = ::FFI::MemoryPointer.new(:int64)
  FFI::CApi.sqlite3_status64(op, p_current, p_highwater, reset)

  {
    current: p_current.read_int64,
    highwater: p_highwater.read_int64
  }
end

.threadsafeObject



31
32
33
# File 'lib/sqlite3/ffi/sqlite3.rb', line 31

def self.threadsafe
  FFI::CApi.sqlite3_threadsafe
end

.threadsafe?Boolean

Was sqlite3 compiled with thread safety on?

Returns:



14
15
16
# File 'lib/sqlite3.rb', line 14

def self.threadsafe?
  threadsafe > 0
end