Re: Using REPLACE INTO with MySQL

2010-03-04 Thread Geoff
@Zaky: although this might not be a SQL standard, it is a part of MySQL, and is useful functionality to use. This is why I am trying to find out whether anyoen else has overcome this problem. Additionally, my web host does not allow me access to create stored procedures, so the stored procedure is

Re: Using REPLACE INTO with MySQL

2010-03-04 Thread Zaky Katalan-Ezra
Why do you want to use this, out of sql standard, statement in the first place According to the documentation the operation performed when there is a match id/index is DELETE then INSERT and not UPDATE. If you have on delete FK constraint or any auto increment columns you are going to face some

Re: Using REPLACE INTO with MySQL

2010-03-04 Thread Dr. Loboto
CakePHP do exactly this if you use InnoDB tables. On Mar 4, 6:15 am, C Gábor wrote: > Just came across the same question. saveField() uses save(), so it > will just either call an INSERT or UPDATE, depending on whether it has > an id set or not. > > REPLACE INTO is a utterly useful SQL statement:

Re: Using REPLACE INTO with MySQL

2010-03-03 Thread C Gábor
Just came across the same question. saveField() uses save(), so it will just either call an INSERT or UPDATE, depending on whether it has an id set or not. REPLACE INTO is a utterly useful SQL statement: You have a table with a id as the primary key, some unique column(s) and then other data fiel

Re: Using REPLACE INTO with MySQL

2010-03-03 Thread genellern
what if u use saveField ?? $this->Model->saveField('field',$data); this way u will only update the field u need On 3 mar, 04:22, Geoff wrote: > Hey all. > > Has anybody needed to use the REPLACE INTO MySQL syntax within a Cake > application? That is, using the REPLACE INTO syntax as you would a

Using REPLACE INTO with MySQL

2010-03-03 Thread Geoff
Hey all. Has anybody needed to use the REPLACE INTO MySQL syntax within a Cake application? That is, using the REPLACE INTO syntax as you would a normal insert [through $Model->save()], as opposed to using raw queries. If you did manage to get this working, could you please enlighten us as to how