Class: Imparcial::Driver::PostgreAdapter

Inherits:
AbstractAdapter show all
Includes:
PostgreExpression, PostgreSQL, PostgreTypemap, PostgreUtil
Defined in:
lib/imparcial/driver/postgre.rb

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#adapter, #conn, #database, #host, #logger, #password, #port, #socket, #username

Instance Method Summary collapse

Methods included from PostgreExpression

#insert, #last_insert_id

Methods included from PostgreTypemap

#regular_types, #sql_types

Methods included from PostgreUtil

#quote, #quote_value

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, #last_insert_id, #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

#total_of_records

Methods included from AbstractExpression::Update

#update

Methods included from AbstractExpression::Delete

#delete, #delete_all

Methods included from AbstractExpression::Select

#select

Methods included from AbstractExpression::Insert

#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_exceptionObject



18
19
20
21
22
# File 'lib/imparcial/driver/postgre.rb', line 18

def adapter_specific_exception

  PGError
  
end

#connectObject



24
25
26
27
28
29
30
31
32
# File 'lib/imparcial/driver/postgre.rb', line 24

def connect

  @conn = PGconn.connect @host, @port, '', '', @database, @username, @password
  
rescue adapter_specific_exception => ex
     
  raise AdapterConnectionError.new(ex.message)
  
end

#query(sql) ⇒ Object



34
35
36
37
38
39
# File 'lib/imparcial/driver/postgre.rb', line 34

def query ( sql )
  
  result  = conn.exec sql
  @result = PostgreResult.new result
  
end