public
Rubygem
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-core.git
Lets make the fix a little less brute force (ticket 275)
wishdev (author)
Sun May 11 22:27:45 -0700 2008
commit  fd483845718f49520842434842bb3cbfbda1f39a
tree    8d628c7f513e62140ff30f40ac385b9558de0c81
parent  7eb18f08d1a15effc2b35e4b3d60853756daf626
...
265
266
267
268
269
270
271
272
273
 
274
275
276
...
265
266
267
 
 
 
 
 
 
268
269
270
271
0
@@ -265,12 +265,7 @@ module DataMapper
0
             command = connection.create_command(sql)
0
             command.set_types(properties.map { |property| property.primitive })
0
 
0
- #Weird looking but necessary - we switch all the nil parameters to IS NULL or IS NOT NULL
0
- #so they need to be stripped out of the parameter array that is passed down to the
0
- #command.execute_reader call
0
- parameters.delete_if { |parm| parm.nil? }
0
-
0
- reader = command.execute_reader(*parameters)
0
+ reader = command.execute_reader(*parameters.compact)
0
 
0
             while(reader.next!)
0
               set.load(reader.values, do_reload)

Comments

  • dkubb Sun May 11 23:22:45 -0700 2008

    This fix gets around a larger issue of how queries are generated by the DOA adapter.

    I believe the DOA#query_read_statement should return not only the statement (as it does now), but also the bind values. If the bind values matched the number of placeholders in the SQL query, this sort of logic problem wouldn’t have occurred.

    For NULL and NOT NULL queries, no placeholder would be present, so there would be no corresponding bind value.