[Typo3-dev] DBAL issues solved for postgresql and mysql

Ries van Twisk typo3 at rvt.dds.nl
Thu Dec 9 18:27:02 CET 2004


Citeren Karsten Dambekalns <k.dambekalns at fishfarm.de>:

> Hi Ries.
>
> On 2004-12-08, Ries van Twisk <typo3 at rvt.dds.nl> wrote:
> > we found some isues using dbal with the folowing functions, comments are
> added
> > with the marking RVT.
>  ...
> > 				$str = $this->handlerInstance[$this->lastHandlerKey]->qstr($str);
> > 				// RVT remove begin and end quotes which has been added by adodb,
> addslashes
> > does not do such a thing
> > 				// so we always return a quoted string WITHOUT begin and end
> quotes!!!!!
>
> NO, NO, NO.
>
> Yesterday the changes needed for the core have been sent to Kapser
> (finally), and quoteStr DOES add single quotes now. We *need* those
> quotes, so we can remove existing hardcoded quotes throughout the code
> and use 'proper' quoting according to the database used (see below).
>

Nice :)
Yesterday we didn't see any other change to change it but do it like this. Since
the native (mysql) version didn't add any single quotes in that particular
function to the end or beginning of a variable but you are right ofcourse.
But this we didn't break any existing code (extentions and core) and we can go
on developing or extentions.

We will be using DBAL a lot in our project so if you have any things to test we
can easely do it on our development server which runs 3.7.0. We both use mysql
for all extentions and core tables and use postgresql for our own table
structures.

> > 				// RVT In case of postgress we don't want to quote a DEFAULT!!
> > 				// is THIS the right place to check for this condition???, maby better
> to
> > override this function in DBAL!!!
> > 				if ($v != 'DEFAULT') {
> > 				  // RVT add begin and end quotes
> > 				  $fields_values[$k] = '\''.$this->quoteStr($v, $table).'\'';
>
> This I don't understand - when would DEFAULT be handed to this
> function? I may be missing something here about PostgreSQL, has
> DEFAULT as a value a special meaning with it?
DEFAULT is in postgresql used to tell the system to insert the default value.
Sometimes it's convenient to use it in when adding values to large tables.
Especially used for the autoincrement.

from : http://www.postgresql.org/docs/7.4/interactive/datatype.html
To insert the next value of the sequence into the serial column, specify that
the serial column should be assigned its default value. This can be done either
by excluding the column from the list of columns in the INSERT statement, or
through the use of the DEFAULT key word.

>
> > 		// RVT replaced double quotes (") with single quotes (') UNTESTED!!!!!!!
>
> Right, exactly this is what my changes (see above) do to the whole
> core. And a lot more, of course. :)
Regards,
Ries






More information about the TYPO3-dev mailing list