Re: database abstraction layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rene Veerman wrote:
On Wed, Feb 3, 2010 at 12:18 AM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx>wrote:

 The problem is where 2 people choose the same instant to perform an
action on your site that inserts a record into your db. The db engine
inserts them one after the other, and then responds about the max(id) to
your PHP script. Then, you now have 2 people who have the same max(id)
retrieved, but one of the values is wrong.


well, i only use getmaxid()s for inserts.
the timelag between getmaxid() and the insert is so small it'd take 300-800
insert-requests/sec
(on that particular table) before an error condition would arise.
in which case, a tested piece of sql would fail, and can be routed through
the retry functions .
These would imo provide ample timing re-randomization, aswell as a measure
of stress-relief for both php and mysql server.
You may correct me if i'm wrong :)

BTW: php core developers: can we have a sleep() that accepts a float? :)

This works right up until someone else maintains this system and can't understand why the database is corrupt. Then they find find your database layer and want to stab themselves :)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux