activerecord-fb-adapter 0.7.3 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,6 +81,13 @@ module ActiveRecord
81
81
  @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale
82
82
  end
83
83
 
84
+ # def type
85
+ # if @type == :binary and @sub_type == 1
86
+ # :text
87
+ # else
88
+ # @type
89
+ # end
90
+ # end
84
91
  def type
85
92
  if @domain =~ /BOOLEAN/
86
93
  :boolean
@@ -152,7 +159,7 @@ module ActiveRecord
152
159
  # adapter to report back the +id+ after a successful insert.)
153
160
  #
154
161
  # === BOOLEAN Domain
155
- # Firebird 1.5 does not provide a native +BOOLEAN+ type. But you can easily
162
+ # Firebird 2.5 does not provide a native +BOOLEAN+ type (Only in Firebird 3.x). But you can easily
156
163
  # define a +BOOLEAN+ _domain_ for this purpose, e.g.:
157
164
  #
158
165
  # CREATE DOMAIN D_BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1));
@@ -169,7 +176,7 @@ module ActiveRecord
169
176
  #
170
177
  # ...you can add the following line to your <tt>environment.rb</tt> file:
171
178
  #
172
- # ActiveRecord::ConnectionAdapters::Fb.boolean_domain = { :true => 'T', :false => 'F' }
179
+ # ActiveRecord::ConnectionAdapters::FbAdapter.boolean_domain = { :true => 'T', :false => 'F' }
173
180
  #
174
181
  # === Column Name Case Semantics
175
182
  # Firebird and ActiveRecord have somewhat conflicting case semantics for
@@ -215,7 +222,7 @@ module ActiveRecord
215
222
  # as column names as well.
216
223
  #
217
224
  # === Migrations
218
- # The Fb adapter does not currently support Migrations.
225
+ # The Fb adapter currently support Migrations.
219
226
  #
220
227
  # == Connection Options
221
228
  # The following options are supported by the Fb adapter.
@@ -505,6 +512,12 @@ module ActiveRecord
505
512
  quote(boolean_domain[:false])
506
513
  end
507
514
 
515
+ def type_cast(value, column)
516
+ return super unless value == true || value == false
517
+
518
+ value ? quoted_true : quoted_false
519
+ end
520
+
508
521
  private
509
522
  # Maps uppercase Firebird column names to lowercase for ActiveRecord;
510
523
  # mixed-case columns retain their original case.
@@ -580,10 +593,11 @@ module ActiveRecord
580
593
  end
581
594
 
582
595
  # Returns the last auto-generated ID from the affected table.
583
- # def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
584
- # execute(sql, name)
585
- # id_value
586
- # end
596
+ def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
597
+ sql, binds = sql_for_insert(to_sql(arel, binds), pk, id_value, sequence_name, binds)
598
+ value = exec_insert(sql, name, binds)
599
+ id_value
600
+ end
587
601
 
588
602
  # Executes the update statement and returns the number of rows affected.
589
603
  # alias_method :update, :execute
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-fb-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 5
10
+ version: 0.7.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brent Rowland
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-09 00:00:00 -07:00
18
+ date: 2013-01-28 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency