}, "SELECT * FROM shopping_cart WHERE sc_id = " + sc_id);
// Here you get sometimes an abort, since two workers try to insert the same shopping_cart
// if (res.length == 0)
// {
UpdateFuture uf = new UpdateFuture();
mw.executeUpdate(transactionUuid, uf, "INSERT INTO shopping_cart (sc_id, sc_c_id, sc_total) VALUES ("
+ sc_id + "," + GENERATOR.nextInt(20000) + ", 0)");
// }
mw.executeQuery(transactionUuid, new QueryFuture() {
public void onResult(String[][] result) {
}
}, "SELECT scl_qty FROM shopping_cart_line WHERE scl_sc_id = "
+ sc_id + " AND scl_i_id =" + i_id);
// if (res.length == 0)
// {
mw.executeUpdate(transactionUuid, new UpdateFuture() {
public void onResult(int result) {
}
}, "INSERT into shopping_cart_line (scl_sc_id, scl_qty, scl_i_id) VALUES ("
+ sc_id + ",1," + i_id + ")");
// }
// else
// {
// mw.executeUpdate("UPDATE shopping_cart_line SET scl_qty = " + generator.nextInt(20) + " WHERE scl_sc_id = "
// + sc_id + " AND scl_i_id = " + i_id);
// }
mw.executeUpdate(transactionUuid, new UpdateFuture() {
public void onResult(int result) {
}
}, "UPDATE shopping_cart SET sc_date = current_timestamp WHERE sc_id = " + sc_id);
mw.commitTransaction(transactionUuid);