Login | Register
My pages Projects Community openCollabNet

Discussions > dev > possible placeholder style change (important!)

propel
Discussion topic

Back to topic list

possible placeholder style change (important!)

Reply

Author hlellelid
Full name Hans Lellelid
Date 2008-03-21 03:42:55 PDT
Message Hi all,

Emmanuel posted an issue with Oracle that I'm attempting to solve.

    http://propel.phpdb.​org/trac/ticket/594

It appears that the PDO Oracle driver does not support positional
placeholders in SQL statements (i.e. using '?' as the bind parameter
placeholder). Why this is the case, I have no idea. I don't want to
hack the resulting SQL to make Oracle work, so as I see it there are two
options:

(1) We file a bug w/ PDO and leave Oracle as not officially supported
until this is resolved. Obviously I think it's the job of the DB API
*abstraction* layer to handle this sort of thing and I consider it a bug
if there's inconsistency between the drivers. Likely this means no
Oracle support until PDO2, which would be unfortunate (especially since
I think otherwise the Oracle support basically works).

(2) We swap out the positional ("?") placeholders for the Oracle
":name"-style place holders. This *feels* like a big change, but I
don't know if it would really affect users at all. I'd like to find out
if it would -- which is why I'm sending this email. I actually have
made the change to my local codebase and the unit tests are passing fine.

Basically, instead of this:

 SELECT * FROM FOO WHERE COL = ? AND COL2 = B
 UPDATE FOO SET COL2 = ? WHERE COL3 = ? AND COL4 = ?
 INSERT INTO FOO (COL,COL2,COL3) VALUES (?,?,?)

You get this:

 SELECT * FROM FOO WHERE COL = :p1 AND COL2 = :p2
 UPDATE FOO SET COL2 = :p1 WHERE COL3 = :p2 AND COL4 = :p3
 INSERT INTO FOO (COL,COL2,COL3) VALUES (:p1,:p2,:p3)

The only place where PDOStatement->bindValue() is called in Propel is
the BasePeer::populateStmtValues() which is called by doInsert(),
doUpdate(), and doSelect().

The changes made to accommodate this switch of naming styles were
primarily focused in the Criterion->appendPsTo() method, and the
BasePeer doInsert() and doUpdate() methods.

What I'd like to do is find out what I'm not thinking of as far as how
this would affect current users. I don't want to roll a change like
this so late in 1.3 development (so close to RC1) without being sure
that we're not going to break backwards compatibility. I know that PDO
provides emulation for name-based placeholders for non-Oracle, but I'm
not sure if there are any other subtle issues -- or maybe performance
concerns?

Feedback appreciated!

Thanks,
Hans

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

possible placeholder style change (important!) hlellelid Hans Lellelid 2008-03-21 03:42:55 PDT
Messages per page: