I need it for Zend_Db_Paginator.
But is it possible to create such a tokeinzer that works for all standard SQL 
[everything that is not standard will fail].

Thanks, Ralph.
 

--- On Thu, 8/12/10, Ralph Schindler <[email protected]> wrote:


From: Ralph Schindler <[email protected]>
Subject: Re: [fw-general] String to Zend_Db_Select Object
To: "Andrei Iarus" <[email protected]>
Cc: "Zend Framework" <[email protected]>
Date: Thursday, August 12, 2010, 6:47 PM


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