Module Amalgalite::SQLite3
In: lib/amalgalite/sqlite3/constants.rb
lib/amalgalite/sqlite3/database/status.rb
lib/amalgalite/sqlite3/status.rb
lib/amalgalite/sqlite3/version.rb
ext/amalgalite3.c

Amagalite Database extension

Methods

Classes and Modules

Module Amalgalite::SQLite3::Constants
Module Amalgalite::SQLite3::Version
Class Amalgalite::SQLite3::Blob
Class Amalgalite::SQLite3::Database
Class Amalgalite::SQLite3::Error
Class Amalgalite::SQLite3::Stat
Class Amalgalite::SQLite3::Statement
Class Amalgalite::SQLite3::Status

Constants

VERSION = Version.to_s.freeze   Version of SQLite that ships with Amalgalite

Public Class methods

Is the text passed in as a parameter a complete SQL statement? Or is additional input required before sending the SQL to the extension. If the extra ‘opts’ parameter is used, you can send in a UTF-16 encoded string as the SQL.

A complete statement must end with a semicolon.

[Source]

/*
 * call-seq:
 *    Amalgalite::SQLite3.complete?( ... , opts = { :utf16 => false }) -> True, False
 *
 * Is the text passed in as a parameter a complete SQL statement?  Or is
 * additional input required before sending the SQL to the extension.  If the
 * extra 'opts' parameter is used, you can send in a UTF-16 encoded string as
 * the SQL.
 *
 * A complete statement must end with a semicolon.
 *
 */
VALUE am_sqlite3_complete(VALUE self, VALUE args)
{
    VALUE sql      = rb_ary_shift( args );
    VALUE opts     = rb_ary_shift( args );
    VALUE utf16    = Qnil;
    int   result = 0;

    if ( ( Qnil != opts ) && ( T_HASH == TYPE(opts) ) ){
        utf16 = rb_hash_aref( opts, rb_intern("utf16") );
    }

    if ( (Qfalse == utf16) || (Qnil == utf16) ) {
        result = sqlite3_complete( StringValuePtr( sql ) );
    } else {
        result = sqlite3_complete16( (void*) StringValuePtr( sql ) );
    }

    return ( result > 0 ) ? Qtrue : Qfalse;
}

Generate N bytes of random data.

[Source]

/*
 * call-seq:
 *    Amalgalite::SQLite3.randomness( N ) -> String of length N
 *
 * Generate N bytes of random data.
 *
 */
VALUE am_sqlite3_randomness(VALUE self, VALUE num_bytes)
{
    int n     = NUM2INT(num_bytes);
    char *buf = ALLOCA_N(char, n);

    sqlite3_randomness( n, buf );
    return rb_str_new( buf, n );
}

return the status object for the sqlite database

[Source]

    # File lib/amalgalite/sqlite3/status.rb, line 59
59:   def self.status
60:     @status ||= Status.new
61:   end

Has the SQLite3 extension been compiled "threadsafe". If threadsafe? is true then the internal SQLite mutexes are enabled and SQLite is threadsafe. That is threadsafe within the context of ‘C’ threads.

[Source]

/*
 * call-seq:
 *    Amalgalite::SQLite3.threadsafe? -> true or false
 *
 * Has the SQLite3 extension been compiled "threadsafe".  If threadsafe? is
 * true then the internal SQLite mutexes are enabled and SQLite is threadsafe.
 * That is threadsafe within the context of 'C' threads.
 *
 */
VALUE am_sqlite3_threadsafe(VALUE self)
{
    if (sqlite3_threadsafe()) {
        return Qtrue;
    } else {
        return Qfalse;
    }
}

[Validate]