[TYPO3-core] RFC: another enhancement to the DB connect method and error display in the FE
Dmitry Dulepov [typo3]
dmitry at typo3.org
Tue Sep 25 10:59:15 CEST 2007
Martin Kutschker wrote:
> Personally I don't like the get_lats_whatever() approach not very much.
> I'm much more in favour of a return object/array style where the results
> and status code etc are in properties. Of course this can't be done here
> because of compatibiliyt. Which is the *only* reason the parameter is
> optional.
That getLastError() approach has another big plus. Currently there is no way to get error message in t3lib_db. There is a method sql_error but this is not truly the same and it does not provide error code for possible analysis and recovery.
And actually, wouldn't TYPO3_DB->sql_error() return this error message if connection fails?
>
> And I think it's up to the caller to format the message nicely. A (low
> level) call should only return a simple string.
I did not mean that I nicely formatted html should be returned, I just expanded the idea of showing this error in FE :) Sure, t3lib_db must not care about html formatting, etc. I thought about function in t3lib_div (it becomes a big mess really!) that can format error messages like this in a standard way and optionally (by default) exit.
--
Dmitry Dulepov
TYPO3 freelancer / TYPO3 core team member
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
More information about the TYPO3-team-core
mailing list