Class: SQLite3::Driver::Native::Driver

Class SQLite3::Driver::Native::Driver |
In: | lib/sqlite3/driver/native/driver.rb
Parent: | Object

Methods

- api_delegate
- bind_text
- busy_handler
- column_decltype
- column_name
- column_text
- complete?
- create_function
- errmsg
- new
- open
- prepare
- result_error
- result_text
- set_authorizer
- trace
- value_text

Public Class methods
api_delegate( name )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 168
    168:     def self.api_delegate( name )
    169:       define_method( name ) { |*args| API.send( "sqlite3_#{name}", *args ) }
    170:     end

new()

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 39
    39:     def initialize
    40:       @callback_data = Hash.new
    41:     end

Public Instance methods
bind_text( stmt, index, value, utf16=false )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 93
    93:     def bind_text( stmt, index, value, utf16=false )
    94:       API.send( ( utf16 ? :sqlite3_bind_text16 : :sqlite3_bind_text ),
    95:         stmt, index, value.to_s )
    96:     end

busy_handler( db, data=nil, &block )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 47
    47:     def busy_handler( db, data=nil, &block )
    48:       if block
    49:         cb = API::CallbackData.new
    50:         cb.proc = block
    51:         cb.data = data
    52:       end
    53:
    54:       API.sqlite3_busy_handler( db,
    55:         block ? API::Sqlite3_ruby_busy_handler : nil, cb )
    56:     end

column_decltype( stmt, index, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 103
    103:     def column_decltype( stmt, index, utf16=false )
    104:       API.send(
    105:         ( utf16 ? :sqlite3_column_decltype16 : :sqlite3_column_decltype ),
    106:         stmt, index )
    107:     end

column_name( stmt, index, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 98
     98:     def column_name( stmt, index, utf16=false )
     99:       API.send( ( utf16 ? :sqlite3_column_name16 : :sqlite3_column_name ),
    100:         stmt, index )
    101:     end

column_text( stmt, index, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 109
    109:     def column_text( stmt, index, utf16=false )
    110:       API.send( ( utf16 ? :sqlite3_column_text16 : :sqlite3_column_text ),
    111:         stmt, index )
    112:     end

complete?( sql, utf16=false )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 43
    43:     def complete?( sql, utf16=false )
    44:       API.send( utf16 ? :sqlite3_complete16 : :sqlite3_complete, sql ) != 0
    45:     end

create_function( db, name, args, text, cookie, func, step, final )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 114
    114:     def create_function( db, name, args, text, cookie, func, step, final )
    115:       if func || ( step && final )
    116:         cb = API::CallbackData.new
    117:         cb.proc = cb.proc2 = nil
    118:         cb.data = cookie
    119:         @callback_data[ name ] = cb
    120:       else
    121:         @callback_data.delete( name )
    122:       end
    123:
    124:       if func
    125:         cb.proc = func
    126:
    127:         func = API::Sqlite3_ruby_function_step
    128:         step = final = nil
    129:       elsif step && final
    130:         cb.proc = step
    131:         cb.proc2 = final
    132:
    133:         func = nil
    134:         step = API::Sqlite3_ruby_function_step
    135:         final = API::Sqlite3_ruby_function_final
    136:       end
    137:
    138:       API.sqlite3_create_function( db, name, args, text, cb, func, step, final )
    139:     end

errmsg( db, utf16=false )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 84
    84:     def errmsg( db, utf16=false )
    85:       API.send( utf16 ? :sqlite3_errmsg16 : :sqlite3_errmsg, db )
    86:     end

open( filename, utf16=false )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 80
    80:     def open( filename, utf16=false )
    81:       API.send( utf16 ? :sqlite3_open16 : :sqlite3_open, filename )
    82:     end

prepare( db, sql, utf16=false )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 88
    88:     def prepare( db, sql, utf16=false )
    89:       API.send( ( utf16 ? :sqlite3_prepare16 : :sqlite3_prepare ),
    90:         db, sql )
    91:     end

result_error( context, value, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 163
    163:     def result_error( context, value, utf16=false )
    164:       API.send( ( utf16 ? :sqlite3_result_error16 : :sqlite3_result_error ),
    165:         context, value )
    166:     end

result_text( context, result, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 152
    152:     def result_text( context, result, utf16=false )
    153:       method = case utf16
    154:         when nil, false then :sqlite3_result_text
    155:         when :le then :sqlite3_result_text16le
    156:         when :be then :sqlite3_result_text16be
    157:         else :sqlite3_result_text16
    158:       end
    159:
    160:       API.send( method, context, result.to_s )
    161:     end

set_authorizer( db, data=nil, &block )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 58
    58:     def set_authorizer( db, data=nil, &block )
    59:       if block
    60:         cb = API::CallbackData.new
    61:         cb.proc = block
    62:         cb.data = data
    63:       end
    64:
    65:       API.sqlite3_set_authorizer( db,
    66:         block ? API::Sqlite3_ruby_authorizer : nil, cb )
    67:     end

trace( db, data=nil, &block )

[ show source ]

        # File lib/sqlite3/driver/native/driver.rb, line 69
    69:     def trace( db, data=nil, &block )
    70:       if block
    71:         cb = API::CallbackData.new
    72:         cb.proc = block
    73:         cb.data = data
    74:       end
    75:
    76:       API.sqlite3_trace( db,
    77:         block ? API::Sqlite3_ruby_trace : nil, cb )
    78:     end

value_text( value, utf16=false )

[ show source ]

         # File lib/sqlite3/driver/native/driver.rb, line 141
    141:     def value_text( value, utf16=false )
    142:       method = case utf16
    143:         when nil, false then :sqlite3_value_text
    144:         when :le then :sqlite3_value_text16le
    145:         when :be then :sqlite3_value_text16be
    146:         else :sqlite3_value_text16
    147:       end
    148:
    149:       API.send( method, value )
    150:     end

[Validate]