public
Fork of sam/dm-core
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/thewordnerd/dm-core.git
Initial stab at adding native binary support.
thewordnerd (author)
Thu Jul 17 07:33:40 -0700 2008
commit  4a46bed59a7b810a3a6115f69ac01113a140a1cf
tree    2c85f6341adab425211865b587201837e0426213
parent  c27a67f6d960d2edd41cd8b6ae3bfee218293816
...
531
532
533
534
535
 
 
536
537
538
...
602
603
604
 
605
606
607
...
531
532
533
 
 
534
535
536
537
538
...
602
603
604
605
606
607
608
0
@@ -531,8 +531,8 @@ module DataMapper
0
             schema = self.class.type_map[property.type].merge(:name => property.field(repository.name))
0
             # TODO: figure out a way to specify the size not be included, even if
0
             # a default is defined in the typemap
0
- # - use this to make it so all TEXT primitive fields do not have size
0
- if property.primitive == String && schema[:primitive] != 'TEXT'
0
+ # - use this to make it so all BLOB and TEXT primitive fields do not have size
0
+ if property.primitive == String && schema[:primitive] != 'BLOB' && schema[:primitive] != 'TEXT'
0
               schema[:size] = property.length
0
             elsif property.primitive == BigDecimal || property.primitive == Float
0
               schema[:precision] = property.precision
0
@@ -602,6 +602,7 @@ module DataMapper
0
               tm.map(Time).to('TIMESTAMP')
0
               tm.map(TrueClass).to('BOOLEAN')
0
               tm.map(DM::Object).to('TEXT')
0
+ tm.map(DM::Binary).to('BLOB')
0
               tm.map(DM::Text).to('TEXT')
0
             end
0
           end
...
11
12
13
 
14
15
16
...
11
12
13
14
15
16
17
0
@@ -11,6 +11,7 @@ module DataMapper
0
           case column_value
0
             when TrueClass then quote_column_value('t')
0
             when FalseClass then quote_column_value('f')
0
+ when DataMapper::Types::Binary then "X'#{column_value}'"
0
             else
0
               super
0
           end
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 dir = Pathname(__FILE__).dirname.expand_path / 'types'
0
 
0
+require dir / "binary"
0
 require dir / 'boolean'
0
 require dir / 'discriminator'
0
 require dir / 'text'

Comments

    No one has commented yet.