Kore Nordmann | 15 May 2007 11:59
Picon
Favicon

Re: Subquery quoting in ezcDatabase

On Thu, 2007-05-03 at 17:47 +0000, Sergey Alyeksyeyev wrote:
> Topic about unquoting numeric values mentioned in description of the 
> in() function. I like unquoting numbers too - it's shorter and quicker a 
> bit.

Dispbling the quoting on per-expression basis imho makes the codes less
intuitive and harder to read. The patch would remove the necessarity to
do this.

> But I think that code above is a kind of BC break ( maybe the permitted 
> one ) because SQL generated for in() will be changed. Besides I'm not 
> sure about correct processing of values for in(). 

I don't think that this should be considered a BC break. We would only
extend the values which could be passed to the method. Strings would be
processed like before.

From my point of view the SQL should be completely transparent to the
user of the component and there a change here shouldn't be considered a
BC break, as long as the results of the queries are still the same.

> F.e. hex values 
> provided like '0xBABE'. User could mean to supply the string or the 
> number and now she could handle this properly. If above code will be 
> applied than the '0xBABE' will be always treated as numeric and added to 
> query without quotes and I'm not  sure that  every DBMS  will  process 
> such queries in the same way.

Instead of using is_numeric() we could use is_int() || is_float(). This
won't cause any type conversions and should be safe in most cases.

> But yes, seems working with subselects became more comfortable if in() 
> allows ezcQuerySubSelect as parameter so this part could be applied 
> without any affect on previous code based on Database component.

Yeah! :)

Any further comments? Otherwise I would open a bug for this...

-- 
Mit freundlichen Grüßen / Med vennlig hilsen

Kore Nordmann (GPG: 0xDDC70BBB)
eZ Components Developer
eZ systems Central and Eastern Europe

tel +49 (0) 231-9742-7750 | fax +49 (0) 231-9742-7751
kn@... | eZ systems | ez.no

******************************************
eZ systems GmbH
Emil-Figge-Str. 76-80
44227 Dortmund
Germany/Deutschland

Geschäftsführer: Ralf Rutke
Handelregister: AG Dortmund, HRB 18800

E-Mail: info.de@...
Web:    www.ez.no
Tel:    +49 (0) 231-9742-7750
****************************************** 

Gmane