[TYPO3-dev] Raising Mysql requirements to 4.1?

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Oct 1 15:54:42 CEST 2007


ries van Twisk schrieb:
> Hey Dmitry,
> 
> and others..
> 
> what if we extension t3lib_db with tree additional functions
> 
> 1) $GLOBAL['TYPO3_DB'] -> beginTransactionBlock();
> 2) $GLOBAL['TYPO3_DB'] -> endTransactionBlock();
> 3) $GLOBAL['TYPO3_DB'] -> abortTransactionBlock();
> 
> And your below function could look like:
> 
>> if (get_resource_type($GLOBALS['TYPO3_DB']->link) == 'mysql link') {
>>     $query = 
>> $GLOBALS['TYPO3_DB']->INSERTquery('tx_realurl_urlencodecache', 
>> $insertFields);
>>     $query .= ' ON DUPLICATE KEY UPDATE tstamp=' . 
>> $insertFields['tstamp'];
>>     $GLOBALS['TYPO3_DB']->sql_query($query);
>> }
>> else {
>         $GLOBAL['TYPO3_DB'] -> beginTransactionBlock();
>>     $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_realurl_urlencodecache', 
>> 'url_hash='.intval($hash));
>>     $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_realurl_urlencodecache', 
>> $insertFields);
>            $GLOBAL['TYPO3_DB'] -> endTransactionBlock();
>> }
> 
> 
> By doing it like that we can start supporting other RDBM's much better.
> For the native MySQL ISAM driver the tree functions above simply don't 
> do anything, with InnoDB we can also use transaction blocks. (Actually MyISAM ignores 
> transaction blocks anyways).

If you care to check for the table type on Mysql you can replace it (in 
this case!) with a TABLE LOCK. But the problem is that you cannot abort it, 
so it's not a general solution.

Intersting is also that the Mysql version does an UPDATE but we have 
DELETE/UPDATE pair on other DBs. Shouldn't that be a SELECT/UPDATE/INSERT 
triple?

Masi




More information about the TYPO3-dev mailing list