Re: Update a row or insert if don´t exist
Posted by:
Armin
Date: June 09, 2005 12:24AM
Hi,
I have the same problem with PHP. (Data synchronisation dBase-File to MySQL)
Did you find a solution?
At them moment I submit a SELECT to the Server.
--> "SELECT `products_id` FROM `" . $ASE_DBTABL_PROD . "` WHERE `products_dist` LIKE '" . $DIST . "' AND `products_anr` LIKE '" . $DIST . $products_anr . "' LIMIT 0 , 1";
If there are rows matching that query I sumit a UPDATE.
--> "UPDATE `" . $ASE_DBTABL_PROD . "` SET `products_hnr` = '" . $products_hnr . "' WHERE `products_dist` LIKE '" . $DIST . "' AND `products_anr` LIKE '" . $DIST . $products_anr . "'"
Otherwise I Submit an INSERT.
--> "INSERT INTO `" . $ASE_DBTABL_PROD . "` (`products_dist`) VALUES ('" . $DIST . "')"
But that stresses the server! MySQL needs 99% cpu for about 3-4 hours!
That SQL-Table has 32.000 rows with 27 Fields.
Knows anybody an other way to do this and get a better performance?
Thanks,
Armin
Subject
Views
Written By
Posted
12666
May 20, 2005 04:45PM
Re: Update a row or insert if don´t exist
4374
June 09, 2005 12:24AM
4778
June 13, 2005 11:06PM
3220
June 14, 2005 03:32AM
3492
June 14, 2005 06:37AM
4149
June 16, 2005 06:52AM
3687
June 16, 2005 07:44PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.