Class: DBI::BaseDatabase

Inherits:
Base
  • Object
show all
Includes:
SQL::BasicQuote
Defined in:
lib/dbi.rb

Overview

class BaseDriver

Direct Known Subclasses

DBD::ADO::Database

Instance Method Summary collapse

Methods included from SQL::BasicQuote

#quote

Constructor Details

#initialize(handle, attr) ⇒ BaseDatabase

Returns a new instance of BaseDatabase.



870
871
872
873
874
# File 'lib/dbi.rb', line 870

def initialize(handle, attr)
   @handle = handle
   @attr   = {}
   attr.each {|k,v| self[k] = v} 
end

Instance Method Details

#[](attr) ⇒ Object



926
927
928
# File 'lib/dbi.rb', line 926

def [](attr)
   @attr[attr]
end

#[]=(attr, value) ⇒ Object

Raises:



930
931
932
# File 'lib/dbi.rb', line 930

def []=(attr, value)
   raise NotSupportedError
end

#columns(table) ⇒ Object



904
905
906
# File 'lib/dbi.rb', line 904

def columns(table)
   []
end

#commitObject

OPTIONAL

Raises:



892
893
894
# File 'lib/dbi.rb', line 892

def commit
   raise NotSupportedError
end

#disconnectObject



876
877
878
# File 'lib/dbi.rb', line 876

def disconnect
   raise NotImplementedError
end

#do(statement, *bindvars) ⇒ Object



916
917
918
919
920
921
# File 'lib/dbi.rb', line 916

def do(statement, *bindvars)
   stmt = execute(statement, *bindvars)
   res = stmt.rows
   stmt.finish
   return res
end

#execute(statement, *bindvars) ⇒ Object



909
910
911
912
913
914
# File 'lib/dbi.rb', line 909

def execute(statement, *bindvars)
   stmt = prepare(statement)
   stmt.bind_params(*bindvars)
   stmt.execute
   stmt
end

#pingObject



880
881
882
# File 'lib/dbi.rb', line 880

def ping
   raise NotImplementedError
end

#prepare(statement) ⇒ Object



884
885
886
# File 'lib/dbi.rb', line 884

def prepare(statement)
   raise NotImplementedError
end

#rollbackObject

Raises:



896
897
898
# File 'lib/dbi.rb', line 896

def rollback
   raise NotSupportedError
end

#tablesObject



900
901
902
# File 'lib/dbi.rb', line 900

def tables
   []
end