Class: Imparcial::Driver::AbstractAdapter
- Inherits:
-
Object
- Object
- Imparcial::Driver::AbstractAdapter
- Includes:
- AbstractExpression, AbstractSQL, AbstractTypemap, AbstractUtil
- Defined in:
- lib/imparcial/driver/abstract.rb
Overview
You have seriously to pay attention on this class. Basically speaking, it servers as abstraction for all new drivers. The idea behind Imparcial is to keep an abstract interface without exposing any dataabstract-specific-features. Of course, it’s an impossible mission anyhow. There are so many dataabases out there and there are so many cool features that make impossible not to expose them. We recommend you to obey the interface as much as possible. However you may develop some specific features. Please, keep an eye on specification(can be found in the website).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#conn ⇒ Object
Description Display connection handle.
-
#database ⇒ Object
Returns the value of attribute database.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
A logger is also required.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#socket ⇒ Object
Returns the value of attribute socket.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#adapter_specific_exception ⇒ Object
Description get the adapter specific’s exception.
-
#close ⇒ Object
Description Terminate a connection.
-
#connect ⇒ Object
Description Stablish a connection.
-
#connection ⇒ Object
Let’s also keep a track of the connection.
- #disable_column_logging ⇒ Object
- #disable_index_logging ⇒ Object
- #disable_insert_logging ⇒ Object
- #disable_record_logging ⇒ Object
- #disable_select_logging ⇒ Object
- #disable_sequence_logging ⇒ Object
- #disable_table_logging ⇒ Object
- #disable_update_logging ⇒ Object
- #enable_column_logging ⇒ Object
- #enable_index_logging ⇒ Object
- #enable_insert_logging ⇒ Object
- #enable_record_logging ⇒ Object
- #enable_select_logging ⇒ Object
- #enable_sequence_logging ⇒ Object
-
#enable_table_logging ⇒ Object
# Logging mechanism # #.
- #enable_update_logging ⇒ Object
- #last_insert_id ⇒ Object
-
#query(sql) ⇒ Object
Description Execute a statement directly to the adapter.
-
#result ⇒ Object
Description After executing a statement, the method query will bring a result.
Methods included from AbstractTypemap
#column_to_field, #default_size_for_types, #field_to_column, #field_to_column_sql, #parse_field, #parse_fields, #regular_types, #sql_types
Methods included from AbstractUtil
#quote, #quote_value, #unquote_value
Methods included from Imparcial::Driver::AbstractExpression::Index
#create_index, #drop_all_indexes, #drop_index, #expected_options_for_dropping_all_indexes, #get_indexes, #index_exists?
Methods included from Imparcial::Driver::AbstractExpression::Transaction
#create_savepoint, #initialize_transaction, #restore_savepoint, #rollback_transaction, #terminate_transaction
Methods included from Imparcial::Driver::AbstractExpression::Record
Methods included from Imparcial::Driver::AbstractExpression::Update
Methods included from Imparcial::Driver::AbstractExpression::Delete
Methods included from Imparcial::Driver::AbstractExpression::Select
Methods included from Imparcial::Driver::AbstractExpression::Insert
Methods included from Imparcial::Driver::AbstractExpression::Constraint
#add_auto_increment, #add_default_value, #add_primary_key
Methods included from Imparcial::Driver::AbstractExpression::Table
#create_table, #diff_columns, #drop_all_tables, #drop_table, #drop_table_if_necessary, #get_tables, #report_modified_columns, #report_new_columns, #report_old_columns, #table_exists?, #table_not_exists?
Methods included from Imparcial::Driver::AbstractExpression::Column
#add_columns, #drop_columns, #get_column_information, #get_columns_information, #modify_columns, #rename_column, #rename_columns
Methods included from Imparcial::Driver::AbstractExpression::Sequence
#create_sequence, #create_sequence_if_necessary, #drop_all_sequences, #drop_sequence, #drop_sequence_if_necessary, #get_sequences, #sequence_exists?
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def adapter @adapter end |
#conn ⇒ Object
Description
Display connection handle.
Returning
a handle.
47 48 49 |
# File 'lib/imparcial/driver/abstract.rb', line 47 def conn @conn end |
#database ⇒ Object
Returns the value of attribute database.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def database @database end |
#host ⇒ Object
Returns the value of attribute host.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def host @host end |
#logger ⇒ Object
A logger is also required.
52 53 54 |
# File 'lib/imparcial/driver/abstract.rb', line 52 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def port @port end |
#socket ⇒ Object
Returns the value of attribute socket.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def socket @socket end |
#username ⇒ Object
Returns the value of attribute username.
54 55 56 |
# File 'lib/imparcial/driver/abstract.rb', line 54 def username @username end |
Instance Method Details
#adapter_specific_exception ⇒ Object
Description
get the adapter specific’s exception.
Returning
an exception class.
138 139 140 141 142 |
# File 'lib/imparcial/driver/abstract.rb', line 138 def adapter_specific_exception raise FeatureNotFound end |
#close ⇒ Object
Description
Terminate a connection.
Returning
nothing.
82 83 84 85 86 |
# File 'lib/imparcial/driver/abstract.rb', line 82 def close conn.close end |
#connect ⇒ Object
Description
Stablish a connection.
Returning
nothing.
114 115 116 117 118 |
# File 'lib/imparcial/driver/abstract.rb', line 114 def connect raise FeatureNotFound end |
#connection ⇒ Object
Let’s also keep a track of the connection.
48 49 50 |
# File 'lib/imparcial/driver/abstract.rb', line 48 def conn @conn end |
#disable_column_logging ⇒ Object
176 177 178 179 180 |
# File 'lib/imparcial/driver/abstract.rb', line 176 def disable_column_logging @column_logging = false end |
#disable_index_logging ⇒ Object
188 189 190 191 192 |
# File 'lib/imparcial/driver/abstract.rb', line 188 def disable_index_logging @index_logging = false end |
#disable_insert_logging ⇒ Object
224 225 226 227 228 |
# File 'lib/imparcial/driver/abstract.rb', line 224 def disable_insert_logging @insert_logging = false end |
#disable_record_logging ⇒ Object
248 249 250 251 252 |
# File 'lib/imparcial/driver/abstract.rb', line 248 def disable_record_logging @record_logging = false end |
#disable_select_logging ⇒ Object
200 201 202 203 204 |
# File 'lib/imparcial/driver/abstract.rb', line 200 def disable_select_logging @select_logging = false end |
#disable_sequence_logging ⇒ Object
236 237 238 239 240 |
# File 'lib/imparcial/driver/abstract.rb', line 236 def disable_sequence_logging @sequence_logging = false end |
#disable_table_logging ⇒ Object
164 165 166 167 168 |
# File 'lib/imparcial/driver/abstract.rb', line 164 def disable_table_logging @table_logging = false end |
#disable_update_logging ⇒ Object
212 213 214 215 216 |
# File 'lib/imparcial/driver/abstract.rb', line 212 def disable_update_logging @update_logging = false end |
#enable_column_logging ⇒ Object
170 171 172 173 174 |
# File 'lib/imparcial/driver/abstract.rb', line 170 def enable_column_logging @column_logging = true end |
#enable_index_logging ⇒ Object
182 183 184 185 186 |
# File 'lib/imparcial/driver/abstract.rb', line 182 def enable_index_logging @index_logging = true end |
#enable_insert_logging ⇒ Object
218 219 220 221 222 |
# File 'lib/imparcial/driver/abstract.rb', line 218 def enable_insert_logging @insert_logging = true end |
#enable_record_logging ⇒ Object
242 243 244 245 246 |
# File 'lib/imparcial/driver/abstract.rb', line 242 def enable_record_logging @record_logging = true end |
#enable_select_logging ⇒ Object
194 195 196 197 198 |
# File 'lib/imparcial/driver/abstract.rb', line 194 def enable_select_logging @select_logging = true end |
#enable_sequence_logging ⇒ Object
230 231 232 233 234 |
# File 'lib/imparcial/driver/abstract.rb', line 230 def enable_sequence_logging @sequence_logging = true end |
#enable_table_logging ⇒ Object
#
Logging mechanism #
#
158 159 160 161 162 |
# File 'lib/imparcial/driver/abstract.rb', line 158 def enable_table_logging @table_logging = true end |
#enable_update_logging ⇒ Object
206 207 208 209 210 |
# File 'lib/imparcial/driver/abstract.rb', line 206 def enable_update_logging @update_logging = true end |
#last_insert_id ⇒ Object
144 145 146 147 148 |
# File 'lib/imparcial/driver/abstract.rb', line 144 def last_insert_id raise FeatureNotFound end |
#query(sql) ⇒ Object
Description
Execute a statement directly to the adapter.
Returning
The method result will be avaliable.
126 127 128 129 130 |
# File 'lib/imparcial/driver/abstract.rb', line 126 def query ( sql ) raise FeatureNotFound end |
#result ⇒ Object
Description
After executing a statement, the method query will bring a result.
Returning
result to a query.
94 95 96 97 98 99 |
# File 'lib/imparcial/driver/abstract.rb', line 94 def result raise ResultError.new('Have you made any query?') unless @result @result end |