| Class | ActiveRecord::ConnectionAdapters::OpenBaseAdapter |
| In: |
vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb
|
| Parent: | AbstractAdapter |
The OpenBase adapter works with the Ruby/Openbase driver by Tetsuya Suzuki. www.spice-of-life.net/ruby-openbase/ (needs version 0.7.3+)
Options:
The OpenBase adapter will make use of OpenBase’s ability to generate unique ids for any column with an unique index applied. Thus, if the value of a primary key is not specified at the time an INSERT is performed, the adapter will prefetch a unique id for the primary key. This prefetching is also necessary in order to return the id after an insert.
Caveat: Operations involving LIMIT and OFFSET do not yet work!
Maintainer: derrick.spell@gmail.com
| update | -> | delete |
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 60
60: def adapter_name
61: 'OpenBase'
62: end
DATABASE STATEMENTS ======================================
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 125
125: def add_limit_offset!(sql, options) #:nodoc
126: if limit = options[:limit]
127: unless offset = options[:offset]
128: sql << " RETURN RESULTS #{limit}"
129: else
130: limit = limit + offset
131: sql << " RETURN RESULTS #{offset} TO #{limit}"
132: end
133: end
134: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 64
64: def native_database_types
65: {
66: :primary_key => "integer UNIQUE INDEX DEFAULT _rowid",
67: :string => { :name => "char", :limit => 4096 },
68: :text => { :name => "text" },
69: :integer => { :name => "integer" },
70: :float => { :name => "float" },
71: :decimal => { :name => "decimal" },
72: :datetime => { :name => "datetime" },
73: :timestamp => { :name => "timestamp" },
74: :time => { :name => "time" },
75: :date => { :name => "date" },
76: :binary => { :name => "object" },
77: :boolean => { :name => "boolean" }
78: }
79: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 93
93: def next_sequence_value(sequence_name)
94: ary = sequence_name.split(' ')
95: if (!ary[1]) then
96: ary[0] =~ /(\w+)_nonstd_seq/
97: ary[0] = $1
98: end
99: @connection.unique_row_id(ary[0], ary[1])
100: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 85
85: def prefetch_primary_key?(table_name = nil)
86: true
87: end
QUOTING ==================================================
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 105
105: def quote(value, column = nil)
106: if value.kind_of?(String) && column && column.type == :binary
107: "'#{@connection.insert_binary(value)}'"
108: else
109: super
110: end
111: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 117
117: def quoted_false
118: "0"
119: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 113
113: def quoted_true
114: "1"
115: end