2009年5月4日星期一

Re: AW: [fw-db] INSERT ... ON DUPLICATE KEY UPDATE

hmm, actually whats the benefit of using Zend_DB functions like
select()->where ... ?

if i use query($sql) directly any downsides? maybe becos i am using a MySQL
specific function, i cannot change db? is Zend_Db adapters and its functions
so that one can change db easily? like MySQL to MSSQL?


Patrick Schulz-2 wrote:
>
> You can use for instance
> function mySave(...) {
> return $re$yourTableInstance->getAdapter()->query('INSERT INTO ... ON
> DUPLICATE KEY UPDATE ...;')->rowCount();
> }
>
>
> This behaves the same like insert() or update() of
> Zend_Db_Adapter_Abstract do.
>
>
>
> Cheers
> Patrick
>
>
> -----Ursprüngliche Nachricht-----
> Von: iceangel89 [mailto:comet2005@gmail.com]
> Gesendet: Montag, 4. Mai 2009 05:49
> An: fw-db@lists.zend.com
> Betreff: [fw-db] INSERT ... ON DUPLICATE KEY UPDATE
>
>
> with Zend_Db(_Table) how can i do a mysql insert...on duplicate key
> update.
>
> for those how dunno what that is ...
> http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
>
> basically it means insert the row if it does not violate unique or primary
> keys else just the row.
> --
> View this message in context:
> http://www.nabble.com/INSERT-...-ON-DUPLICATE-KEY-UPDATE-tp23362664p23362664.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/INSERT-...-ON-DUPLICATE-KEY-UPDATE-tp23362664p23379782.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: