Created
June 8, 2017 10:44
-
-
Save idler/bb1c9078ccc0f06ef3a8565a7a91f1bb to your computer and use it in GitHub Desktop.
java fuck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private PreparedStatement getPreparedCategoryQuery() { | |
if (categoryPreparedQuery == null) { | |
try { | |
categoryPreparedQuery = dbconn.prepareStatement("INSERT INTO category (code) values(?)"); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
try { | |
categoryPreparedQuery.clearParameters(); | |
categoryPreparedQuery.clearWarnings(); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
return categoryPreparedQuery; | |
} | |
public void createCategory(String code) { | |
LOG.info("CREATING Category with code = " + code); | |
PreparedStatement st = getPreparedCategoryQuery(); | |
try { | |
st.setString(1, code); | |
boolean result = st.execute(); | |
if (!result) { | |
LOG.error("FAILED ADD CATEGORY with code = " + code); | |
LOG.error(st.getWarnings()); | |
}else{ | |
LOG.info("success"); | |
} | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment