[TYPO3-core] RFC #11916: Feature: New TYPO3_DB method for queries that expect just a single result row

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Nov 16 16:53:05 CET 2010


JoH asenau schrieb am 14.11.2010 16:24:
>>> comment for $numIndex was wrong. Attached is v3 which fixes this.
>>
>> +1 by reading with two questions/remarks:
>> 1. The debug line could be copied from exec_SELECTgetRows() (three
>> lines with {})
>> 2. if $output is initialized outside the if (!$this->sql_error()), how
>> can I distinguish between an empty result set and an error? (if
>> exec_SELECTgetRows() returns NULL something must have gone wrong)
> 
> Attached is v4 which fixes the issues.
> 
> Thx for the reviews

If there is an error in the SQL, why not throw an exception? This is a
new method and we are not bound to follow the "old principles", just
because other methods do some hackish way.

So that new method should either return an array or it will throw an
exception, which the caller could catch or if not catched, the developer
will see a nice stack trace.

Cheers,
Ernesto



More information about the TYPO3-team-core mailing list