com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException Java Examples

The following examples show how to use com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapleRing.java    From mapleLemon with GNU General Public License v2.0 5 votes vote down vote up
public static int[] makeRing(int itemId, MapleCharacter player, MapleCharacter partnerPlayer)
        throws Exception {
    int[] makeRingId = {MapleInventoryIdentifier.getInstance(), MapleInventoryIdentifier.getInstance()};
    try {
        addToDB(itemId, player, partnerPlayer.getName(), partnerPlayer.getId(), makeRingId);
    } catch (MySQLIntegrityConstraintViolationException mslcve) {
        return makeRingId;
    }
    return makeRingId;
}
 
Example #2
Source File: MapleRing.java    From mapleLemon with GNU General Public License v2.0 5 votes vote down vote up
public static int makeRing(int itemId, MapleCharacter player, String partnerName, int partnerId, String msg, int itemSn) throws Exception {
    int[] makeRingId = {MapleInventoryIdentifier.getInstance(), MapleInventoryIdentifier.getInstance()};
    try {
        addToDB(itemId, player, partnerName, partnerId, makeRingId);
    } catch (MySQLIntegrityConstraintViolationException mslcve) {
        return 0;
    }
    MapleInventoryManipulator.addRing(player, itemId, makeRingId[1], itemSn);
    player.getCashInventory().gift(partnerId, player.getName(), msg, itemSn, makeRingId[0]);
    return 1;
}