Class Sequel::Oracle::Database
In: lib/sequel/adapters/oracle.rb
Parent: Sequel::Database

Methods

Included Modules

DatabaseMethods

Constants

CONNECTION_ERROR_CODES = [ 28, 1012, 3113, 3114 ]   ORA-00028: your session has been killed ORA-01012: not logged on ORA-03113: end-of-file on communication channel ORA-03114: not connected to ORACLE

Public Instance methods

[Source]

    # File lib/sequel/adapters/oracle.rb, line 16
16:       def connect(server)
17:         opts = server_opts(server)
18:         if opts[:database]
19:           dbname = opts[:host] ? \
20:             "//#{opts[:host]}#{":#{opts[:port]}" if opts[:port]}/#{opts[:database]}" : opts[:database]
21:         else
22:           dbname = opts[:host]
23:         end
24:         conn = OCI8.new(opts[:user], opts[:password], dbname, opts[:privilege])
25:         conn.autocommit = true
26:         conn.non_blocking = true
27:         conn
28:       end

[Source]

    # File lib/sequel/adapters/oracle.rb, line 30
30:       def dataset(opts = nil)
31:         Oracle::Dataset.new(self, opts)
32:       end
do(sql, opts={})

Alias for execute

[Source]

    # File lib/sequel/adapters/oracle.rb, line 62
62:       def execute(sql, opts={})
63:         log_info(sql)
64:         synchronize(opts[:server]) do |conn|
65:           begin
66:             r = conn.exec(sql)
67:             yield(r) if block_given?
68:             r
69:           rescue OCIException => e
70:             if CONNECTION_ERROR_CODES.include?(e.code)  
71:               raise(Sequel::DatabaseDisconnectError)              
72:             else
73:               raise
74:             end
75:           end
76:         end
77:       end

[Source]

    # File lib/sequel/adapters/oracle.rb, line 34
34:       def schema_parse_table(table, opts={})
35:         ds = dataset
36:         ds.identifier_output_method = :downcase
37:         schema, table = schema_and_table(table)
38:         table_schema = []
39:         metadata = transaction(opts){|conn| conn.describe_table(table.to_s)}
40:         metadata.columns.each do |column|
41:           table_schema << [
42:             column.name.downcase.to_sym,
43:             {
44:               :type => column.data_type,
45:               :db_type => column.type_string.split(' ')[0],
46:               :type_string => column.type_string,
47:               :charset_form => column.charset_form,
48:               :char_used => column.char_used?,
49:               :char_size => column.char_size,
50:               :data_size => column.data_size,
51:               :precision => column.precision,
52:               :scale => column.scale,
53:               :fsprecision => column.fsprecision,
54:               :lfprecision => column.lfprecision,
55:               :allow_null => column.nullable?
56:             }
57:           ]
58:         end
59:         table_schema
60:       end

[Validate]