Kuzu::

Connection class

Kùzu database connection class

Public Class Methods

new( database ) → connection

Create a Kuzu::Connection to the specified database.

static VALUE
rkuzu_connection_initialize( VALUE self, VALUE database )
{
        kuzu_connection *ptr = check_connection( self );

        if ( !ptr ) {
                rkuzu_database *dbobject = rkuzu_check_database( database );
                ptr = ALLOC( kuzu_connection );

                if ( kuzu_connection_init(&dbobject->db, ptr) == KuzuError ) {
                        rb_raise( rkuzu_eConnectionError, "Failed to connect!" );
                        xfree( ptr );
                        ptr = NULL;
                }

                DATA_PTR( self ) = ptr;
                rb_ary_push( dbobject->connections, self );
        } else {
                rb_raise( rb_eRuntimeError, "cannot reinit connection" );
        }

        rb_call_super( 0, 0 );

        return Qtrue;
}