List of usage examples for java.sql CallableStatement getLong
long getLong(String parameterName) throws SQLException;
BIGINT
parameter as a long
in the Java programming language. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseClusterTable.java
public long nextConfigurationFileIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "nextConfigurationFileIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/*from ww w. j ava 2 s .co m*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextConfigurationFileIdGen = null; try { String sql = "{ call sp_next_configurationfileidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextConfigurationFileIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextConfigurationFileIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextConfigurationFileIdGen.setLong(argIdx++, Id); stmtSelectNextConfigurationFileIdGen.execute(); long nextId = stmtSelectNextConfigurationFileIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextConfigurationFileIdGen != null) { try { stmtSelectNextConfigurationFileIdGen.close(); } catch (SQLException e) { } stmtSelectNextConfigurationFileIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseClusterTable.java
public long nextSecGroupIncludeIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextSecGroupIncludeIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }// w w w .j a v a 2 s . c o m Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextSecGroupIncludeIdGen = null; try { String sql = "{ call sp_next_secgroupincludeidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextSecGroupIncludeIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextSecGroupIncludeIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextSecGroupIncludeIdGen.setLong(argIdx++, Id); stmtSelectNextSecGroupIncludeIdGen.execute(); long nextId = stmtSelectNextSecGroupIncludeIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextSecGroupIncludeIdGen != null) { try { stmtSelectNextSecGroupIncludeIdGen.close(); } catch (SQLException e) { } stmtSelectNextSecGroupIncludeIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseClusterTable.java
public long nextConfigurationFileIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextConfigurationFileIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }//w w w . j ava 2 s . c o m Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextConfigurationFileIdGen = null; try { String sql = "{ call sp_next_configurationfileidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextConfigurationFileIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextConfigurationFileIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextConfigurationFileIdGen.setLong(argIdx++, Id); stmtSelectNextConfigurationFileIdGen.execute(); long nextId = stmtSelectNextConfigurationFileIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextConfigurationFileIdGen != null) { try { stmtSelectNextConfigurationFileIdGen.close(); } catch (SQLException e) { } stmtSelectNextConfigurationFileIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public long nextTenantIdGen() { if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "nextTenantIdGen", "Not in a transaction"); }//from w ww.j a v a 2 s.c o m CallableStatement stmtNext = null; try { final String sql = "{ call sp_next_tenantidgen( ? ) }"; stmtNext = cnx.prepareCall(sql); stmtNext.registerOutParameter(1, java.sql.Types.BIGINT); stmtNext.execute(); long nextId = stmtNext.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "nextTenantIdGen", e); } finally { if (stmtNext != null) { try { stmtNext.close(); } catch (SQLException e) { } stmtNext = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public long nextClusterIdGen() { if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "nextClusterIdGen", "Not in a transaction"); }//w w w . j a v a 2 s .c o m CallableStatement stmtNext = null; try { final String sql = "{ call sp_next_clusteridgen( ? ) }"; stmtNext = cnx.prepareCall(sql); stmtNext.registerOutParameter(1, java.sql.Types.BIGINT); stmtNext.execute(); long nextId = stmtNext.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "nextClusterIdGen", e); } finally { if (stmtNext != null) { try { stmtNext.close(); } catch (SQLException e) { } stmtNext = null; } } }
From source file:com.netspective.axiom.sql.StoredProcedureParameter.java
/** * Extract the OUT parameter values from the callable statment and * assign them to the value of the parameter. *//*from w w w . j a v a 2s . co m*/ public void extract(ConnectionContext cc, CallableStatement stmt) throws SQLException { if (getType().getValueIndex() == StoredProcedureParameter.Type.IN) return; int index = this.getIndex(); QueryParameterType paramType = getSqlType(); int jdbcType = paramType.getJdbcType(); String identifier = paramType.getIdentifier(); // result sets are special if (identifier.equals(QueryParameterType.RESULTSET_IDENTIFIER)) { ResultSet rs = (ResultSet) stmt.getObject(index); QueryResultSet qrs = new QueryResultSet(getParent().getProcedure(), cc, rs); value.getValue(cc).setValue(qrs); return; } switch (jdbcType) { case Types.VARCHAR: value.getValue(cc).setTextValue(stmt.getString(index)); break; case Types.INTEGER: value.getValue(cc).setValue(new Integer(stmt.getInt(index))); break; case Types.DOUBLE: value.getValue(cc).setValue(new Double(stmt.getDouble(index))); break; case Types.CLOB: Clob clob = stmt.getClob(index); value.getValue(cc).setTextValue(clob.getSubString(1, (int) clob.length())); break; case java.sql.Types.ARRAY: Array array = stmt.getArray(index); value.getValue(cc).setValue(array); break; case java.sql.Types.BIGINT: long bigint = stmt.getLong(index); value.getValue(cc).setValue(new Long(bigint)); break; case java.sql.Types.BINARY: value.getValue(cc).setTextValue(new String(stmt.getBytes(index))); break; case java.sql.Types.BIT: boolean bit = stmt.getBoolean(index); value.getValue(cc).setValue(new Boolean(bit)); case java.sql.Types.BLOB: value.getValue(cc).setValue(stmt.getBlob(index)); break; case java.sql.Types.CHAR: value.getValue(cc).setTextValue(stmt.getString(index)); break; case java.sql.Types.DATE: value.getValue(cc).setValue(stmt.getDate(index)); break; case java.sql.Types.DECIMAL: value.getValue(cc).setValue(stmt.getBigDecimal(index)); break; case java.sql.Types.DISTINCT: value.getValue(cc).setValue(stmt.getObject(index)); break; case java.sql.Types.FLOAT: value.getValue(cc).setValue(new Float(stmt.getFloat(index))); break; case java.sql.Types.JAVA_OBJECT: value.getValue(cc).setValue(stmt.getObject(index)); break; case java.sql.Types.LONGVARBINARY: value.getValue(cc).setTextValue(new String(stmt.getBytes(index))); break; case java.sql.Types.LONGVARCHAR: value.getValue(cc).setTextValue(stmt.getString(index)); break; //case java.sql.Types.NULL: // value.getValue(cc).setValue(null); // break; case java.sql.Types.NUMERIC: value.getValue(cc).setValue(stmt.getBigDecimal(index)); break; case java.sql.Types.OTHER: value.getValue(cc).setValue(stmt.getObject(index)); break; case java.sql.Types.REAL: value.getValue(cc).setValue(new Float(stmt.getFloat(index))); break; //case java.sql.Types.REF: // Ref ref = stmt.getRef(index); // break; case java.sql.Types.SMALLINT: short sh = stmt.getShort(index); value.getValue(cc).setValue(new Short(sh)); break; case java.sql.Types.STRUCT: value.getValue(cc).setValue(stmt.getObject(index)); break; case java.sql.Types.TIME: value.getValue(cc).setValue(stmt.getTime(index)); break; case java.sql.Types.TIMESTAMP: value.getValue(cc).setValue(stmt.getTimestamp(index)); break; case java.sql.Types.TINYINT: byte b = stmt.getByte(index); value.getValue(cc).setValue(new Byte(b)); break; case java.sql.Types.VARBINARY: value.getValue(cc).setValue(stmt.getBytes(index)); break; default: throw new RuntimeException( "Unknown JDBC Type set for stored procedure parameter '" + this.getName() + "'."); } }
From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java
public long nextSecGroupMemberIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) { final String S_ProcName = "nextSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }//from w w w . j a v a 2 s. com Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextSecGroupMemberIdGen = null; try { String sql = "{ call sp_next_secgroupmemberidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextSecGroupMemberIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextSecGroupMemberIdGen.setLong(argIdx++, Id); stmtSelectNextSecGroupMemberIdGen.execute(); long nextId = stmtSelectNextSecGroupMemberIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextSecGroupMemberIdGen != null) { try { stmtSelectNextSecGroupMemberIdGen.close(); } catch (SQLException e) { } stmtSelectNextSecGroupMemberIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java
public long nextSecGroupIncludeIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) { final String S_ProcName = "nextSecGroupIncludeIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/*from w ww.j a va2 s .c o m*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextSecGroupIncludeIdGen = null; try { String sql = "{ call sp_next_secgroupincludeidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextSecGroupIncludeIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextSecGroupIncludeIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextSecGroupIncludeIdGen.setLong(argIdx++, Id); stmtSelectNextSecGroupIncludeIdGen.execute(); long nextId = stmtSelectNextSecGroupIncludeIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextSecGroupIncludeIdGen != null) { try { stmtSelectNextSecGroupIncludeIdGen.close(); } catch (SQLException e) { } stmtSelectNextSecGroupIncludeIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java
public long nextSecGroupFormIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) { final String S_ProcName = "nextSecGroupFormIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }// ww w. j a v a2 s . c o m Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextSecGroupFormIdGen = null; try { String sql = "{ call sp_next_secgroupformidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextSecGroupFormIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextSecGroupFormIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextSecGroupFormIdGen.setLong(argIdx++, Id); stmtSelectNextSecGroupFormIdGen.execute(); long nextId = stmtSelectNextSecGroupFormIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextSecGroupFormIdGen != null) { try { stmtSelectNextSecGroupFormIdGen.close(); } catch (SQLException e) { } stmtSelectNextSecGroupFormIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java
public long nextServiceIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) { final String S_ProcName = "nextServiceIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/* ww w.ja v a 2s . co m*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextServiceIdGen = null; try { String sql = "{ call sp_next_serviceidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextServiceIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextServiceIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextServiceIdGen.setLong(argIdx++, Id); stmtSelectNextServiceIdGen.execute(); long nextId = stmtSelectNextServiceIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextServiceIdGen != null) { try { stmtSelectNextServiceIdGen.close(); } catch (SQLException e) { } stmtSelectNextServiceIdGen = null; } } }