This is not possible. For that to happen, you'd need an SQL parser/tokenizer, which there is not one in ZF. Moreover, the SQL you have is probably somewhat specific to a particular vendor implementation of SQL which, again, would make it really hard to build a parser/tokenizer that knows about these variances in SQL.

There are only a few major parts that need to be really looked at, and for most cases, you can use Zend_Db_Expr to fill in parts where you do not want to parameterize them. (For example $select->where(new Zend_Db_Expr('a = 500 AND b LIKE "FOO"));)

Why do you want to do this anyway? Do you need to be able to mutate your current query? If that is the case, then creating your query as a Zend_Db_Select might be worth it in the long run.

-ralph

Andrei Iarus wrote:
Hello to all,
Any ideas on how to cast/transform a string to an object of type Zend_Db_Select? Ideally, without rewriting it by hand. Thank you very much


Reply via email to