Class: Imparcial::Driver::MysqlAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- Imparcial::Driver::MysqlAdapter
- Includes:
- MysqlExpression, MysqlSQL, MysqlTypemap, MysqlUtil
- Defined in:
- lib/imparcial/driver/mysql.rb
Instance Attribute Summary
Attributes inherited from AbstractAdapter
#adapter, #conn, #database, #host, #logger, #password, #port, #socket, #username
Instance Method Summary collapse
- #adapter_specific_exception ⇒ Object
- #connect ⇒ Object
- #last_insert_id ⇒ Object
- #query(sql) ⇒ Object
Methods included from MysqlTypemap
Methods included from MysqlUtil
Methods inherited from AbstractAdapter
#close, #connection, #disable_column_logging, #disable_index_logging, #disable_insert_logging, #disable_record_logging, #disable_select_logging, #disable_sequence_logging, #disable_table_logging, #disable_update_logging, #enable_column_logging, #enable_index_logging, #enable_insert_logging, #enable_record_logging, #enable_select_logging, #enable_sequence_logging, #enable_table_logging, #enable_update_logging, #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 AbstractExpression::Index
#create_index, #drop_all_indexes, #drop_index, #expected_options_for_dropping_all_indexes, #get_indexes, #index_exists?
Methods included from AbstractExpression::Transaction
#create_savepoint, #initialize_transaction, #restore_savepoint, #rollback_transaction, #terminate_transaction
Methods included from AbstractExpression::Record
Methods included from AbstractExpression::Update
Methods included from AbstractExpression::Delete
Methods included from AbstractExpression::Select
Methods included from AbstractExpression::Insert
Methods included from AbstractExpression::Constraint
#add_auto_increment, #add_default_value, #add_primary_key
Methods included from 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 AbstractExpression::Column
#add_columns, #drop_columns, #get_column_information, #get_columns_information, #modify_columns, #rename_column, #rename_columns
Methods included from AbstractExpression::Sequence
#create_sequence, #create_sequence_if_necessary, #drop_all_sequences, #drop_sequence, #drop_sequence_if_necessary, #get_sequences, #sequence_exists?
Instance Method Details
#adapter_specific_exception ⇒ Object
18 19 20 21 22 |
# File 'lib/imparcial/driver/mysql.rb', line 18 def adapter_specific_exception Mysql::Error end |
#connect ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/imparcial/driver/mysql.rb', line 24 def connect @conn = Mysql.real_connect @host, @username, @password, @database, @port, @socket rescue adapter_specific_exception => ex raise AdapterConnectionError.new(ex.) end |
#last_insert_id ⇒ Object
41 42 43 44 45 |
# File 'lib/imparcial/driver/mysql.rb', line 41 def last_insert_id conn.last_insert_id end |
#query(sql) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/imparcial/driver/mysql.rb', line 34 def query ( sql ) result = conn.query sql @result = MysqlResult.new result end |