[TYPO3-core] RFC #15457: Add support for prepared queries

Xavier Perseguers typo3 at perseguers.ch
Tue Aug 17 13:45:24 CEST 2010


Hi Ernesto,

I'm OK with your changes. Thanks.

And your explanation to Jigal is fine too.

Xavier

Ernesto Baschny [cron IT] wrote:
> Hi Xavier,
>
> this is really great!
>
> Attached is my suggestion (v4). To see what changed from your patch
> (v3), I also attach a diff of the changes I made from v3 to v4
> (15457-v3-v4.diff).
>
>  From Helmut's comment:
> - get rid of "is_numeric" and use is_int when possible.
> - cast with intval() when the parameter is supposed to be an integer
>
> - added a $stmt->seek() because I use it some times. Strange thing that
> PDO doesn't support it.
>
> - enhanced some comments and error messages.
>
> +1 on reading, reviewing and testing.
>
> Cheers,
> Ernesto
>
> Xavier Perseguers schrieb am 16.08.2010 22:21:
>
>> Please find v3 attached.
>>
>> We had kind of a live discussion with other core devs this morning and
>> here is the summary:
>>
>> - "Old way" of creating queries ($GLOBALS['TYPO3_DB']->exec_* methods
>> will still work as before. Only if you explicitly call the
>> prepare_SELECTquery method will you gain access to enhanced DB API
>>
>> - We want to provide a PDO-like syntax but we don't aim at having a
>> PDO-compatible implementation. We can provide enhancements and we should
>> not fear having some goodies. We want to learn from Extbase (this is why
>> I added some chaining feature for instance)
>>
>> What as changed basically with this new version:
>>
>> - Took comments into account
>> - Enhanced the documentation with some examples which render properly
>> when compiling documentation with doxygen or phpdoc
>> - Removed bindParam() method (borrowed from PDO) because we do not like
>> this way of programming and it hardly make sense in TYPO3. In PDO it is
>> used mainly for getting back parameters. We do not have that in TYPO3.
>> - Added bindValues() which takes an array of parameters. A complement to
>> the bindValue() method which acts as the parameter you may pass to
>> execute() but with a potentially clearer separation.
>> - Added chaining on both bindValue() and bindValues()
>>
>> Sorry. Did not have time to provide unit tests.
>>
>> Cheers
>> Xavier
>>
>


More information about the TYPO3-team-core mailing list