You are here: Re: A Question of design. « PHP Programming Language « IT news, forums, messages
Re: A Question of design.

Posted by Tim Roberts on 10/26/06 04:20

"Rik" <luiheidsgoeroe@hotmail.com> wrote:

>Chung Leong wrote:
>>
>> No, that still wouldn't remove the race condition. What you want to do
>> is put a unique constraint on the table, then have your script just
>> perform the INSERT. If it fails, then you know you have a duplicate.
>> MySQL also support the INSERT ... ON DUPLICATE KEY UPDATE syntax I
>> believe.
>
>Yup, or the shorter REPLACE INTO which does exactly the same.

.... as long as one understands that "REPLACE INTO" is a MySQL-only
extension. If one plans to upgrade to Postgres or a commercial database,
one will have to remember to change that back to INSERT/UPDATE.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация