Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into release-1.2

  • Loading branch information...
commit 1e5035b4df0e9cc9334424497261a41a481241b1 2 parents 73cca09 + cbf09cd
Piotr Solnica authored September 20, 2011
2  .gitignore
@@ -33,3 +33,5 @@ Gemfile.*
33 33
 
34 34
 ## PROJECT::SPECIFIC
35 35
 spec/db/
  36
+
  37
+nbproject
1  Gemfile
@@ -29,6 +29,7 @@ group :development do
29 29
 end
30 30
 
31 31
 platforms :mri_18 do
  32
+  gem 'ruby-oci8'
32 33
   group :quality do
33 34
 
34 35
     gem 'rcov',      '~> 0.9.9'
13  lib/dm-oracle-adapter/adapter.rb
@@ -3,10 +3,7 @@
3 3
 
4 4
 module DataMapper
5 5
 
6  
-  class Property
7  
-    # for custom sequence names
8  
-    OPTIONS << :sequence
9  
-  end
  6
+  Property.accept_options(:sequence)
10 7
 
11 8
   module Adapters
12 9
     class OracleAdapter < DataObjectsAdapter
@@ -102,8 +99,8 @@ def select_statement(query)
102 99
 
103 100
           # create subquery to find all valid keys and then use these keys to retrive all other columns
104 101
           use_subquery = qualify
105  
-          no_group_by  = group_by.blank?
106  
-          no_order     = order.blank?
  102
+          no_group_by  = DataMapper::Ext.blank?(group_by)
  103
+          no_order     = DataMapper::Ext.blank?(order)
107 104
 
108 105
           # when we can include ROWNUM condition in main WHERE clause
109 106
           use_simple_rownum_limit = limit && (offset||0 == 0) && no_group_by && no_order
@@ -141,11 +138,11 @@ def select_statement(query)
141 138
           end
142 139
           statement << from_statement
143 140
           statement << join_statement(query, bind_values, qualify)     if qualify
144  
-          statement << " WHERE (#{conditions_statement})" unless conditions_statement.blank?
  141
+          statement << " WHERE (#{conditions_statement})" unless DataMapper::Ext.blank?(conditions_statement)
145 142
           if use_subquery
146 143
             statement << ")"
147 144
           end
148  
-          if use_simple_rownum_limit
  145
+          if use_simple_rownum_limit && limit
149 146
             statement << " AND rownum <= ?"
150 147
             bind_values << limit
151 148
           end
8  lib/dm-oracle-adapter/spec/setup.rb
@@ -6,9 +6,15 @@ module Spec
6 6
     module Adapters
7 7
 
8 8
       class OracleAdapter < Adapter
9  
-        def test_connection
  9
+        
  10
+        def test_connection(adapter)
10 11
           adapter.select('SELECT 1 FROM dual')
11 12
         end
  13
+
  14
+        def storage_name
  15
+          ENV.fetch("#{name}_storage_name", super())
  16
+        end
  17
+
12 18
       end
13 19
 
14 20
       use OracleAdapter
2  spec/adapter_spec.rb
@@ -55,7 +55,7 @@ def sql_log_buffer
55 55
     @repository = DataMapper.repository(@adapter.name)
56 56
 
57 57
     # speed up test execution
58  
-    @adapter.class_eval do
  58
+    @adapter.class.class_eval do
59 59
       auto_migrate_with :delete           # table data will be deleted instead of dropping and creating table
60 60
       auto_migrate_reset_sequences false  # primary key sequences will not be reset
61 61
     end

0 notes on commit 1e5035b

Please sign in to comment.
Something went wrong with that request. Please try again.