[TYPO3-dev] Raising Mysql requirements to 4.1?
ries van Twisk
typo3 at rvt.dds.nl
Mon Oct 1 15:43:38 CEST 2007
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).
But for other databases we can start making TYPO3 transactional save.
I am perfectly fine with your 'mysql link' check function to support
the functions within
a specific database. Although it would be better if we support within
TYPO3_DB a special
insertOrUpdate function so we can move specific RDMB code out of
extensions (like
we don't want to have hardcoded HTML in PHP).
What do you all think?
Ries
On Oct 1, 2007, at 8:09 AM, Dmitry Dulepov [typo3] wrote:
> Hi!
>
> Steffen Kamper wrote:
>> i thought about the double cache entry problem - could be solved
>> in mysql
>> using that syntax (see in BT), other db's may have simular
>> function for
>> that.
>
> I did similar thing in pre-release version of realurl (available
> from by blog). It is a bit dirty but works and I could not find
> better solution. Code snippet:
>
> ---------------
> 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 {
> $GLOBALS['TYPO3_DB']->exec_DELETEquery
> ('tx_realurl_urlencodecache', 'url_hash='.intval($hash));
> $GLOBALS['TYPO3_DB']->exec_INSERTquery
> ('tx_realurl_urlencodecache', $insertFields);
> }
> ---------------
>
> Another alternative is using transaction syntax, which is portable
> but will work only with InnoDb on mysql, which is a problem
> again... I decided to go with mysql-specific extensions because
> most typo3 users use mysql.
>
> --
> Dmitry Dulepov
> TYPO3 freelancer / TYPO3 core team member
> Web: http://typo3bloke.net/
> Skype: callto:liels_bugs
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
--
Ries van Twisk
Freelance TYPO3 Developer
email: ries at vantwisk.nl
web: http://www.rvantwisk.nl/
skype: callto://r.vantwisk
Phone: + 1 810-476-4193
More information about the TYPO3-dev
mailing list