[TYPO3-core] RFC #12351: Clean-up SQL parser and SQL engine

Xavier Perseguers typo3 at perseguers.ch
Mon Oct 26 17:15:45 CET 2009


Hi Ernesto,

>> This is an SVN patch request.
>>
>> Type: Cleanup
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=12351
>> http://bugs.typo3.org/view.php?id=12349 (related patch for DBAL if you
>> need it)
>>
>> Branches: trunk
>>
>> Problem:
>> This patch adds visibility to methods of t3lib_sqlengine and
>> t3lib_sqlparser and applies CGL on modified lines.
>>
>> Purpose is to ease creation of unit tests.
> 
> You choose to make these functions private:
> 
> t3lib_sqlparser:
> parseSELECT
> parseUPDATE
> parseINSERT
> parseDELETE
> parseEXPLAIN
> parseCREATETABLE
> parseALTERTABLE
> parseDROPTABLE
> parseCREATEDATABASE
> nextPart
> getValue
> getValueInQuotes
> parseStripslashes
> parseError
> trimSQL
> compileSELECT
> compileUPDATE
> compileDELETE
> 
> t3lib_sqlengine:
> processAccordingToConfig
> 
> How can you be sure that noone else is accessing / using these function
> as they have always been public before?

I cannot of course. I checked that DBAL - which is the only extension I know that is extending those classes - was still able to work. And I tried to restrict as much as possible the visibility.

It's a bit tricky in all cases as we have this in Core:

class t3lib_sqlengine extends t3lib_sqlparser

and in DBAL:

class ux_t3lib_sqlengine extends t3lib_sqlengine
class ux_t3lib_sqlparser extends t3lib_sqlparser

Meaning we loose in ux_t3lib_sqlengine what was overriden in ux_t3lib_sqlparser, which is why we have to copy lots of code from ux_t3lib_sqlparser.

Anyway, this is an attempt to restrict access and make visibility more "official" and this is an RFC, meaning if you don't agree to some visibility or find that something breaks, you may provide 
another patch. Of course it would be easier to make all methods public arguing that they were implicitly public before but I prefer trying to make a "breaking" change that should not be one at all as 
I pretend that extension authors use exec_ methods if they did their code the way they should and many simply used mysql_* calls directly.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-team-core mailing list