Class: Ladybug::Connection
- Inherits:
-
Object
- Object
- Ladybug::Connection
- Extended by:
- Loggability
- Defined in:
- lib/ladybug/connection.rb
Overview
Kùzu connection class
Instance Method Summary collapse
-
#execute(statement, **bound_variables, &block) ⇒ Object
Executes the given
statement(a Ladybug::PreparedStatement) after binding the givenbound_variablesto it. -
#inspect ⇒ Object
Return a string representation of the receiver suitable for debugging.
-
#prepare(query_string) ⇒ Object
Create a new Ladybug::PreparedStatement for the specified
query_string. -
#query(query_string, &block) ⇒ Object
Execute the given
query_stringvia the connection and return the Ladybug::Result.
Instance Method Details
#execute(statement, **bound_variables, &block) ⇒ Object
Executes the given statement (a Ladybug::PreparedStatement) after binding
the given bound_variables to it.
35 36 37 38 |
# File 'lib/ladybug/connection.rb', line 35 def execute( statement, **bound_variables, &block ) statement.bind( **bound_variables ) return statement.execute end |
#inspect ⇒ Object
Return a string representation of the receiver suitable for debugging.
42 43 44 45 46 47 48 49 |
# File 'lib/ladybug/connection.rb', line 42 def inspect details = " threads:%d" % [ self.max_num_threads_for_exec, ] default = super return default.sub( />/, details + '>' ) end |
#prepare(query_string) ⇒ Object
Create a new Ladybug::PreparedStatement for the specified query_string.
28 29 30 |
# File 'lib/ladybug/connection.rb', line 28 def prepare( query_string ) return Ladybug::PreparedStatement.new( self, query_string ) end |
#query(query_string, &block) ⇒ Object
Execute the given query_string via the connection and return the
Ladybug::Result. If a block is given, the result will instead be yielded to it,
finished when it returns, and the return value of the block will be returned
instead.
21 22 23 24 |
# File 'lib/ladybug/connection.rb', line 21 def query( query_string, &block ) result = self._query( query_string ) return Ladybug::Result.wrap_block_result( result, &block ) end |