Michael A. Schoen wrote:
Michael Koziarski wrote:
If instead of doing the value interpolation immediately, we could hold
off and pass the full sql string down to the adapter.

["FULL SQL STRING", bunch, of, values]

Would be much nicer, but I wasn't sure how to even approach that, given how frequently the sql is manipulated as a string.

I've posted my patch for the regex approach to bind variables:

        http://dev.rubyonrails.org/ticket/5199

I decided to just leave it in the oracle adapter for now, given that there appears to be interest in doing this the "right" way, as Koz writes above. And though I've gotten the regex approach to work well enough (it passes all the AR units tests and my own app works properly), it still feels brittle and silly (esp. since it binds ALL literals in the statement, often many more than really necessary).

IOW, I'd rather that this patch NOT be applied -- in fact I think my approach should be looked at with good humor, and then thrown away, in favor of representing an executable sql statement as an array of statement and bind values. With each connection adapter handling as appropriate, interpolating in Ruby if necessary or using native bind variables.

That approach will also mean changing how we generate UPDATE and INSERT statements, since they are currently generated from scratch as literal sql, and we'll want all the values to be bound.


_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to