123456789_123456789_123456789_123456789_123456789_

Module: SQLite3

Constant Summary

Class Attribute Summary

Class Method Summary

Class Attribute Details

.sqlcipher?Boolean (readonly)

[ GitHub ]

  
# File 'ext/sqlite3/sqlite3.c', line 69

static VALUE
using_sqlcipher(VALUE UNUSED(klass))
{
#ifdef USING_SQLCIPHER
    return Qtrue;
#else
    return Qfalse;
#endif
}

.threadsafe (readonly)

Returns the compile time setting of the SQLITE_THREADSAFE flag. See: www.sqlite.org/c3ref/threadsafe.html

[ GitHub ]

  
# File 'ext/sqlite3/sqlite3.c', line 82

static VALUE
threadsafe_p(VALUE UNUSED(klass))
{
    return INT2NUM(sqlite3_threadsafe());
}

.threadsafe?Boolean (readonly)

Was sqlite3 compiled with thread safety on?

[ GitHub ]

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

def self.threadsafe?
  threadsafe > 0
end

Class Method Details

.libversion

[ GitHub ]

  
# File 'ext/sqlite3/sqlite3.c', line 63

static VALUE
libversion(VALUE UNUSED(klass))
{
    return INT2NUM(sqlite3_libversion_number());
}

.status(parameter) → Hash) .status(parameter, reset_flag = false) → Hash)

Queries the SQLite3 library for run-time status information. Passing a truthy reset_flag will reset the highwater mark to the current value.

Parameters
  • parameter (Integer, ::SQLite3::Constants::Status): The status parameter to query.

  • reset_flag (Boolean): Whether to reset the highwater mark. (default is false)

Returns

A Hash containing :current and :highwater keys for integer values.

[ GitHub ]

  
# File 'ext/sqlite3/sqlite3.c', line 103

static VALUE
rb_sqlite3_status(int argc, VALUE *argv, VALUE klass)
{
    VALUE opArg, resetFlagArg;

    rb_scan_args(argc, argv, "11", &opArg, &resetFlagArg);

    int op = NUM2INT(opArg);
    bool resetFlag = RTEST(resetFlagArg);

    int pCurrent = 0;
    int pHighwater = 0;
    sqlite3_status(op, &pCurrent, &pHighwater, resetFlag);

    VALUE hash = rb_hash_new();
    rb_hash_aset(hash, ID2SYM(rb_intern("current")), INT2FIX(pCurrent));
    rb_hash_aset(hash, ID2SYM(rb_intern("highwater")), INT2FIX(pHighwater));

    return hash;
}