Hi,

So the deal here (in my case): if I want to join on numeric columns (and
that are datatyped as such in mysql), the conversion doesn't take that much
time in small tables; however, in large ones, it will add up.

It's just that I don't know the reasoning behind the omission of this
feature going from Zf1 to Zf2.

If you're building a statement to be prepared, none of this should be of too much consequence to you, here why ...

Let's say you create the proper expression for you ON clause, that describes an expression that has a value:

(for reference)
https://github.com/zendframework/zf2/blob/master/tests/ZendTest/Db/Sql/SelectTest.php#L951-L961

    $select->from('foo')
        ->join('tableA', new Predicate\Operator('id', '=', 1));

In this case, the query is being prepared separate from the data, b/c this is the resulting query passed in (assuming PDO/mysql for example) is:

    SELECT "foo".*, "tableA".*
    FROM "foo" INNER JOIN "tableA" ON "id" = :join1part1

Then when that statement is executed, your PHP integer will be passed into $pdoStatement->bindParam().

The only time you'll see actual quoting is if you decided to getSqlString() on that $select object, which one would only do for debugging/profiling etc. The actual statement is a prepared and executed statement with values separate from the SQL which are evaluated after (IIRC) the query/execution plan has been assembled.

In short, always use prepare & execute / (parameritized queries).

Hope this helps,
Ralph

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to