Class: Sequel::Oracle::Database

Inherits:
Database show all
Defined in:
lib/sequel/adapters/oracle.rb

Constant Summary

Constants inherited from Database

Database::SQL_BEGIN, Database::SQL_COMMIT, Database::SQL_ROLLBACK

Constants included from Schema::SQL

Schema::SQL::AUTOINCREMENT, Schema::SQL::CASCADE, Schema::SQL::COMMA_SEPARATOR, Schema::SQL::NOT_NULL, Schema::SQL::NO_ACTION, Schema::SQL::PRIMARY_KEY, Schema::SQL::RESTRICT, Schema::SQL::SET_DEFAULT, Schema::SQL::SET_NULL, Schema::SQL::TYPES, Schema::SQL::UNDERSCORE, Schema::SQL::UNIQUE

Instance Attribute Summary

Attributes inherited from Database

#logger, #opts, #pool

Instance Method Summary collapse

Methods inherited from Database

#<<, #[], adapter_class, adapter_scheme, #add_column, #add_index, #alter_table, connect, #create_or_replace_view, #create_table, #create_table!, #create_view, #drop_column, #drop_index, #drop_table, #drop_view, #fetch, #from, #initialize, #multi_threaded?, #query, #rename_column, #rename_table, #select, #serial_primary_key_options, set_adapter_scheme, #set_column_default, #set_column_type, single_threaded=, #single_threaded?, #synchronize, #table_exists?, #test_connection, #transaction, #uri, uri_to_options

Methods included from Schema::SQL

#alter_table_sql, #alter_table_sql_list, #auto_increment_sql, #column_definition_sql, #column_list_sql, #create_table_sql_list, #default_index_name, #drop_table_sql, #index_definition_sql, #index_list_sql_list, #literal, #on_delete_clause, #rename_table_sql, #schema_utility_dataset

Constructor Details

This class inherits a constructor from Sequel::Database

Instance Method Details

#connectObject

AUTO_INCREMENT = ‘IDENTITY(1,1)’.freeze

def auto_increment_sql

AUTO_INCREMENT

end



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sequel/adapters/oracle.rb', line 14

def connect
  if @opts[:database]
    dbname = @opts[:host] ? \
      "//#{@opts[:host]}/#{@opts[:database]}" : @opts[:database]
  else
    dbname = @opts[:host]
  end
  conn = OCI8.new(@opts[:user], @opts[:password], dbname, @opts[:privilege])
  conn.autocommit = true
  conn.non_blocking = true
  conn
end

#dataset(opts = nil) ⇒ Object



31
32
33
# File 'lib/sequel/adapters/oracle.rb', line 31

def dataset(opts = nil)
  Oracle::Dataset.new(self, opts)
end

#disconnectObject



27
28
29
# File 'lib/sequel/adapters/oracle.rb', line 27

def disconnect
  @pool.disconnect {|c| c.logoff}
end

#execute(sql) ⇒ Object Also known as: do



35
36
37
38
# File 'lib/sequel/adapters/oracle.rb', line 35

def execute(sql)
  @logger.info(sql) if @logger
  @pool.hold {|conn| conn.exec(sql)}
end