[TYPO3-core] RFC #15457: Add support for prepared queries [summary and pending questions]

Helmut Hummel helmut at typo3.org
Thu Aug 19 19:22:30 CEST 2010


Hi Ernesto,

On 19.08.10 15:42, Ernesto Baschny [cron IT] wrote:
> 
> if (is_bool($value)) {
>   $type = self::PARAM_BOOL;
> } elseif (t3lib_div::testInt($value)) {
>   $type = self::PARAM_INT;
> } elseif (is_null($value) || strtoupper($value) === 'NULL') {
>   $type = self::PARAM_NULL;
> } else {
>   $type = self::PARAM_STR;
> }
> 
> So pretty easy to understand and document. Only concearn might be
> "testInt()", which allows also strings that looks like integer ('1' =>
> 1). I would not oppose to change that to is_int() to have it more strict.

That's exactly what I thought, too. I would also prefer to change this
to is_int(), the we have a clean behaviour of PARAM_AUTOTYPE converting
PHP types into DBMS types. When leaving testInt(), it would introduce
some additional "magic" which might be unwanted. E.g. quering for a zip
code '01234', which is a string value in the database and passed as PHP
string would be converted to integer 1234, if the PARAM_STR is not
expicitly passed when binding the value.

Regards Helmut


More information about the TYPO3-team-core mailing list