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: derrickspell@cdmplus.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 124 124: def add_limit_offset!(sql, options) #:nodoc 125: if limit = options[:limit] 126: unless offset = options[:offset] 127: sql << " RETURN RESULTS #{limit}" 128: else 129: limit = limit + offset 130: sql << " RETURN RESULTS #{offset} TO #{limit}" 131: end 132: end 133: 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: :datetime => { :name => "datetime" }, 72: :timestamp => { :name => "timestamp" }, 73: :time => { :name => "time" }, 74: :date => { :name => "date" }, 75: :binary => { :name => "object" }, 76: :boolean => { :name => "boolean" } 77: } 78: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 92 92: def next_sequence_value(sequence_name) 93: ary = sequence_name.split(' ') 94: if (!ary[1]) then 95: ary[0] =~ /(\w+)_nonstd_seq/ 96: ary[0] = $1 97: end 98: @connection.unique_row_id(ary[0], ary[1]) 99: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 84 84: def prefetch_primary_key?(table_name = nil) 85: true 86: end
QUOTING ==================================================
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 104 104: def quote(value, column = nil) 105: if value.kind_of?(String) && column && column.type == :binary 106: "'#{@connection.insert_binary(value)}'" 107: else 108: super 109: end 110: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 116 116: def quoted_false 117: "0" 118: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 112 112: def quoted_true 113: "1" 114: end