Help for this page

Select Code to Download


  1. or download this
    $dbh->do("INSERT INTO tbl VALUES(NULL,'foo','bar')");
    
  2. or download this
    my $ref = $dbh->selectcol_arrayref(
        "SELECT MAX(LineID) FROM tbl"
    );
    my $LineID = $$ref_booking[0];
    
  3. or download this
    my $ref = $dbh->selectcol_arrayref(
        "SELECT LAST_INSERT_ID() FROM tbl
    ");
    
  4. or download this
    $dbh->{AutoCommit} = 0;  # enable transactions, if possible
    $dbh->{RaiseError} = 1;
    ...
        $dbh->rollback; # undo the incomplete changes
        # add other application on-error-clean-up code here
    }