Re: cvs: pear /DB/DB dbase.php fbsql.php ibase.php ifx.php msql.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sqlite.php sybase.php

From: Date: Sat, 03 Jan 2004 05:26:28 +0000
Subject: Re: cvs: pear /DB/DB dbase.php fbsql.php ibase.php ifx.php msql.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sqlite.php sybase.php
References: 1 2 3  Groups: php.pear.cvs php.pear.qa 
Request: Send a blank email to pear-qa+get-327@lists.php.net to get a copy of this message
Daniel Convissor wrote:
Hi Lukas, et al: On Sat, Jan 03, 2004 at 01:58:20AM +0100, Lukas Smith wrote:
- 'portability' will remain as it is now (lowercasing across all drivers), maybe evening adding the rtrim call (I think in MDB the ibase driver does that too) - add an option to get the old behaviour - add a smartquote() - remove magic stuff from quote() - add an option to keep the old magic in quote()
I had a look through the thread on PEAR:DB & oracle. the problem with absolute portability is that you end up with the worst crap from all databases :) In reality, portability is most likely to mean working on 3-4 (at most) out of the 8 supported databases. If you need to support oracle then using lc keys looks like the only option. - but otherwise it is a bit of a annoyance to other drivers if you never use oracle, but need other features of portability.. If it was being done fresh today.. the best solution would be $option['portability'] = DB_PORTABILITY_LOWERCASE + //1 DB_PORTABILITY_DELETE_FIX + //2 DB_PORTABILITY_NUMROWS + //4 this could be added as a condition in setOption: if ($option== 'optimize') { $this->options['portability'] = ($value='portability') ? 7 : 0; } I would suggest a) making portibility a depreciated option b) modify the tableInfo returns to do the lowercasing as well.
The point of quote() is to make a variable safe for insertion into a query.
Not acording to the docs "DB_Common::quote() -- quotes a string" It's not about putting "'" around everything. If it were, there'd
be no reason for the method, since it'd be easier for programmers to just do that themselves.
One of the main failings of using PHP types to determine quoting is quoting should be dependant on the field type in the databases (not the PHP type) - From what I remember, postgres used to be famous for raising errors if you dont quote a string field, or quote numerics. (seems that works ok now..) what we now have: quote - escapes and sometimes quotes quoteString - escapes (and doesnt quote!) All that was really needed was something that always escapes and quotes a string, when asked to.. Ideal solution: quotePhpValue = current behaviour quote = quote and escape. escape = just escape string. Options a) Leave as was: + No BC issues - broken in both ways (neither a magic quoting, or pure quoting) b) Fix magic & add method simpleQuote + at least behaviour is consistant. + reasonably BC - method name / documentation not perfect.. c) Massive rename - breaks BC badly... + makes naming far more sensible. b) looks like the best option here. Regards Alan
Thanks, --Dan
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.qa (#327) next »