Class: ladybug::Connection
- Inherits:
-
Object
- Object
- ladybug::Connection
- Defined in:
- ext/ladybug_ext/connection.c
Instance Method Summary collapse
-
#database ⇒ Object
(also: #db)
Return the database object the connection belongs to (a Ladybug::Database).
-
#max_num_threads_for_exec ⇒ Integer
Returns the maximum number of threads of the connection to use for executing queries.
-
#max_num_threads_for_exec=(integer) ⇒ Object
Sets the maximum number of threads of the connection to use for executing queries.
-
#query!(query_string) ⇒ Object
(also: #run)
Execute the given
query_stringand returntrueif the query was successful. -
#query_timeout=(integer) ⇒ Object
Sets query timeout value in milliseconds for the connection.
Instance Method Details
#database ⇒ Object Also known as: db
Return the database object the connection belongs to (a Ladybug::Database).
291 292 293 294 295 296 |
# File 'ext/ladybug_ext/connection.c', line 291
static VALUE
rlbug_connection_database( VALUE self )
{
rlbug_connection *ptr = CHECK_CONNECTION( self );
return ptr->database;
}
|
#max_num_threads_for_exec ⇒ Integer
Returns the maximum number of threads of the connection to use for executing queries.
227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'ext/ladybug_ext/connection.c', line 227
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) ⇒ Object
Sets the maximum number of threads of the connection to use for executing queries.
249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'ext/ladybug_ext/connection.c', line 249
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) ⇒ Object Also known as: run
Execute the given query_string and return true if the query was
successful.
211 212 213 214 215 216 |
# File 'ext/ladybug_ext/connection.c', line 211
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;
}
|
#query_timeout=(integer) ⇒ Object
Sets query timeout value in milliseconds for the connection.
270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'ext/ladybug_ext/connection.c', line 270
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;
}
|