On Dec 5, 2009, at 10:34 AM, Rusty Brooks wrote:


I'm not sure what would happen if you had actual binding, like the oracle driver and did this

If you want to learn how Oracle bind variables work, the Oracle documentation is online ...


set val NULL
set sql "update mytable set mycolumn=:val"

You get 'NULL', not NULL, as is true with the bindvar emulation we do in the postgres driver.


but I suspect it would work as expected (you'd get NULL in the column).

You'd be wrong.


The compatibility mode, as it's described (never used it) is very nice but probably doesn't act like actual variable binding in every possible case?


Yes, it does, actually, it treats the empty string as NULL, just as happens with Oracle bind variables.

That's why we called it "bindvar emulation" when we did it ... if it didn't properly emulate Oracle it wouldn't be very useful for writing queries that work the same in both RDBMS's, which was the whole point of the exercise in the first place (safety against "SQL smuggling" is a nice side-effect, but was not the motivation for providing this in the driver).

----
Don Baccus
http://donb.photo.net
http://birdnotes.net
http://openacs.org


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to