Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    $sth = $dbh->prepare("insert foo(bar)value(1) on duplicate key update 
    +baz=1;");
    $redo = 1; while ($redo) {$redo=0; try {$rows=$sth->execute();} catch 
    +{$redo = /deadlock found/i;}}
    print "old on duplicate key update: $rows";
    
  2. or download this
    new: 1
    old ignore: 0E0
    old on duplicate key update: 2
    
  3. or download this
    # MariaDB [scratch]> select * from foo;
    # +-----+------+
    ...
    # |           2 |
    # +-------------+
    # 1 row in set (0.00 sec)