ladybug::

Connection class

Public Instance Methods

database → database

Return the database object the connection belongs to (a Ladybug::Database).

static VALUE
rlbug_connection_database( VALUE self )
{
        rlbug_connection *ptr = CHECK_CONNECTION( self );
        return ptr->database;
}
Also aliased as: db
db()

Return the database object the connection belongs to (a Ladybug::Database).

Alias for: database
max_num_threads_for_exec → integer

Returns the maximum number of threads of the connection to use for executing queries.

static VALUE
rlbug_connection_max_num_threads_for_exec( VALUE self )
{
        rlbug_connection *ptr = CHECK_CONNECTION( self );
        uint64_t count;

        if ( lbug_connection_get_max_num_thread_for_exec( &ptr->conn, &count ) != LbugSuccess ) {
                rb_raise( rlbug_eError, "lbug_connection_get_max_num_thread_for_exec failed" );
        }

        return ULONG2NUM( count );
}
max_num_threads_for_exec = integer

Sets the maximum number of threads of the connection to use for executing queries.

static VALUE
rlbug_connection_max_num_threads_for_exec_eq( VALUE self, VALUE count )
{
        rlbug_connection *ptr = CHECK_CONNECTION( self );
        uint64_t thread_count = NUM2ULONG( count );

        if ( lbug_connection_set_max_num_thread_for_exec( &ptr->conn, thread_count ) != LbugSuccess ) {
                rb_raise( rlbug_eError, "lbug_connection_set_max_num_thread_for_exec failed" );
        }

        return Qtrue;
}
query!( query_string )

Execute the given query_string and return true if the query was successful.

static VALUE
rlbug_connection_query_bang( VALUE self, VALUE query )
{
        lbug_query_result result = rlbug_connection_do_query( self, query );
        return lbug_query_result_is_success( &result ) ? Qtrue : Qfalse;
}
Also aliased as: run
query_timeout = integer

Sets query timeout value in milliseconds for the connection.

static VALUE
rlbug_connection_query_timeout_eq( VALUE self, VALUE timeout )
{
        rlbug_connection *ptr = CHECK_CONNECTION( self );
        uint64_t timeout_in_ms = NUM2ULONG( timeout );

        if ( lbug_connection_set_query_timeout( &ptr->conn, timeout_in_ms ) != LbugSuccess ) {
                rb_raise( rlbug_eError, "lbug_connection_set_query_timeout failed" );
        }

        return Qtrue;
}
run(p1)

Execute the given query_string and return true if the query was successful.

Alias for: query!