| 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
| VERSION | = | Version.to_s.freeze | Version of SQLite that ships with Amalgalite |
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.
/*
* 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.
/*
* 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 );
}
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.
/*
* 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;
}
}