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:
- :host — Defaults to localhost
- :username — Defaults to nothing
- :password — Defaults to nothing
- :database — The name of the database. No default, must be provided.
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
- adapter_name
- native_database_types
- next_sequence_value
- prefetch_primary_key?
- quote
- quoted_false
- quoted_true
- supports_migrations?
[ show source ]
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 60
60: def adapter_name
61: 'OpenBase'
62: end
[ show source ]
# 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
[ show source ]
# 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
[ show source ]
# 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 ==================================================
[ show source ]
# 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
[ show source ]
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 117
117: def quoted_false
118: "0"
119: end
[ show source ]
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 113
113: def quoted_true
114: "1"
115: end
[ show source ]
# File vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb, line 81
81: def supports_migrations?
82: false
83: end