List of usage examples for java.sql CallableStatement setString
void setString(String parameterName, String x) throws SQLException;
String
value. From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates KPA vaccines dates and create a callable statement * * @param connection current connection//from w ww. j a va2 s. c o m * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateKPA(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_KPA_VACCINES); for (int i = 0; i < KPA_DATES.length; i++) { calendar.add(Calendar.DATE, KPA_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates OPA vaccines dates and create a callable statement * * @param connection current connection/*from www . ja v a2s. c o m*/ * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateOPA(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_OPA_VACCINES); for (int i = 0; i < OPA_DATES.length; i++) { calendar.add(Calendar.DATE, OPA_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates RVA vaccines dates and create a callable statement * * @param connection current connection/*from ww w . j a va2s . c o m*/ * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateRVA(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_RVA_VACCINES); for (int i = 0; i < RVA_DATES.length; i++) { calendar.add(Calendar.DATE, RVA_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates DABT IPA HIB vaccines dates and create a callable statement * * @param connection current connection// w ww. j a v a 2 s. c o m * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateDaBT_IPA_HIB(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_DaBT_IPA_HIB); for (int i = 0; i < DaBT_IPA_HIB_DATES.length; i++) { calendar.add(Calendar.DATE, DaBT_IPA_HIB_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates HEPATITIS A vaccines dates and create a callable statement * * @param connection current connection/* w w w . j a va 2s . com*/ * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateHepatit_A(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_HEPATIT_A_VACCINES); for (int i = 0; i < HEPATIT_A_DATES.length; i++) { calendar.add(Calendar.DATE, HEPATIT_A_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:com.hackengine_er.muslumyusuf.DBOperations.java
/** * Calculates HEPATITIS B vaccines dates and create a callable statement * * @param connection current connection/*from ww w. j a v a2 s . c o m*/ * @param date_of_birth of baby * @return a callableStatement included necessary informations or null if * catches SQLException or ParseException */ private CallableStatement calculateHepatit_B(Connection connection, String date_of_birth) { try { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateFormat.format(dateFormat.parse(date_of_birth))); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); CallableStatement tempCall = connection.prepareCall(DbStoredProcedures.ADD_HEPATIT_B_VACCINES); for (int i = 0; i < HEPATIT_B_DATES.length; i++) { calendar.add(Calendar.DATE, HEPATIT_B_DATES[i]); tempCall.setString(i + 1, dateFormat.format(calendar.getTime())); calendar.setTime(date); } return tempCall; } catch (SQLException | ParseException ex) { Logger.getLogger(DBOperations.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSysClusterTable.java
public void deleteSysCluster(CFSecurityAuthorization Authorization, CFSecuritySysClusterBuff Buff) { final String S_ProcName = "deleteSysCluster"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {//from www . j av a 2 s . c om int SingletonId = Buff.getRequiredSingletonId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_sysclus( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setInt(argIdx++, SingletonId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleAuditActionTable.java
public void deleteAuditAction(CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "deleteAuditAction"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/* www . ja va2 s . co m*/ short AuditActionId = Buff.getRequiredAuditActionId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, AuditActionId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAuditActionTable.java
public void deleteAuditAction(CFAccAuthorization Authorization, CFAccAuditActionBuff Buff) { final String S_ProcName = "deleteAuditAction"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/*from w ww . j a va 2s . c o m*/ short AuditActionId = Buff.getRequiredAuditActionId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".dl_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, AuditActionId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleAuditActionTable.java
public void deleteAuditAction(CFAstAuthorization Authorization, CFAstAuditActionBuff Buff) { final String S_ProcName = "deleteAuditAction"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/*from ww w. j a v a 2s. com*/ short AuditActionId = Buff.getRequiredAuditActionId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".dl_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, AuditActionId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }