Class: DBI::BaseDatabase
- Includes:
- SQL::BasicQuote
- Defined in:
- lib/dbi.rb
Overview
class BaseDriver
Direct Known Subclasses
Instance Method Summary collapse
- #[](attr) ⇒ Object
- #[]=(attr, value) ⇒ Object
- #columns(table) ⇒ Object
-
#commit ⇒ Object
OPTIONAL ============================================.
- #disconnect ⇒ Object
- #do(statement, *bindvars) ⇒ Object
- #execute(statement, *bindvars) ⇒ Object
-
#initialize(handle, attr) ⇒ BaseDatabase
constructor
A new instance of BaseDatabase.
- #ping ⇒ Object
- #prepare(statement) ⇒ Object
- #rollback ⇒ Object
- #tables ⇒ Object
Methods included from SQL::BasicQuote
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
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 |
#commit ⇒ Object
OPTIONAL
892 893 894 |
# File 'lib/dbi.rb', line 892 def commit raise NotSupportedError end |
#disconnect ⇒ Object
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 |
#prepare(statement) ⇒ Object
884 885 886 |
# File 'lib/dbi.rb', line 884 def prepare(statement) raise NotImplementedError end |
#rollback ⇒ Object
896 897 898 |
# File 'lib/dbi.rb', line 896 def rollback raise NotSupportedError end |
#tables ⇒ Object
900 901 902 |
# File 'lib/dbi.rb', line 900 def tables [] end |