List of usage examples for java.sql Types SMALLINT
int SMALLINT
To view the source code for java.sql Types SMALLINT.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type SMALLINT
.
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "readBuffByCrCcyIdx"; ResultSet resultSet = null;/*from w ww .j a v a 2s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerSchemaDbName() + ".sp_read_ac_entry_by_crccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByCrCcyIdx == null) { stmtReadBuffByCrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CreditCurrencyId != null) { stmtReadBuffByCrCcyIdx.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtReadBuffByCrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtReadBuffByCrCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlContactTable.java
public void deleteContactByTimezoneIdx(CFAccAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from ww w . ja va2 s . c o m*/ ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_delete_contact_by_timezoneidx ?, ?, ?, ?, ?" + ", " + "?"; if (stmtDeleteByTimezoneIdx == null) { stmtDeleteByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argISOTimezoneId != null) { stmtDeleteByTimezoneIdx.setShort(argIdx++, argISOTimezoneId.shortValue()); } else { stmtDeleteByTimezoneIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } Object stuff = null; boolean moreResults = stmtDeleteByTimezoneIdx.execute(); while (stuff == null) { try { moreResults = stmtDeleteByTimezoneIdx.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { stuff = stmtDeleteByTimezoneIdx.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtDeleteByTimezoneIdx.getUpdateCount()) { break; } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { final String S_ProcName = "readBuffByDrCcyIdx"; ResultSet resultSet = null;/*from www . j ava 2s. com*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_ac_entry_by_drccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByDrCcyIdx == null) { stmtReadBuffByDrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (DebitCurrencyId != null) { stmtReadBuffByDrCcyIdx.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtReadBuffByDrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } try { resultSet = stmtReadBuffByDrCcyIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while ((resultSet != null) && resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "readBuffByCrCcyIdx"; ResultSet resultSet = null;//from w w w . j a v a2 s .co m try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_ac_entry_by_crccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadBuffByCrCcyIdx == null) { stmtReadBuffByCrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CreditCurrencyId != null) { stmtReadBuffByCrCcyIdx.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtReadBuffByCrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtReadBuffByCrCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); if (resultSet != null) { while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmOracle.CFCrmOracleAddressTable.java
public void deleteAddressByCountryIdx(CFCrmAuthorization Authorization, Short argCountryId) { final String S_ProcName = "deleteAddressByCountryIdx"; ResultSet resultSet = null;//from w ww . j a va 2 s . com try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_addressbycountryidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByCountryIdx == null) { stmtDeleteByCountryIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCountryId != null) { stmtDeleteByCountryIdx.setShort(argIdx++, argCountryId.shortValue()); } else { stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } int rowsUpdated = stmtDeleteByCountryIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "readBuffByCrCcyIdx"; ResultSet resultSet = null;/* www .ja va 2 s. com*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_ac_entry_by_crccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByCrCcyIdx == null) { stmtReadBuffByCrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CreditCurrencyId != null) { stmtReadBuffByCrCcyIdx.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtReadBuffByCrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } try { resultSet = stmtReadBuffByCrCcyIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while ((resultSet != null) && resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAddressTable.java
public void deleteAddressByCountryIdx(CFAccAuthorization Authorization, Short argCountryId) { final String S_ProcName = "deleteAddressByCountryIdx"; ResultSet resultSet = null;//from w w w . j a va 2 s .c o m try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_addressbycountryidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByCountryIdx == null) { stmtDeleteByCountryIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCountryId != null) { stmtDeleteByCountryIdx.setShort(argIdx++, argCountryId.shortValue()); } else { stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } int rowsUpdated = stmtDeleteByCountryIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleContactTable.java
public void deleteContactByTimezoneIdx(CFAccAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; ResultSet resultSet = null;/* w ww.j a va2 s . co m*/ try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_contactbytimezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByTimezoneIdx == null) { stmtDeleteByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argISOTimezoneId != null) { stmtDeleteByTimezoneIdx.setShort(argIdx++, argISOTimezoneId.shortValue()); } else { stmtDeleteByTimezoneIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } int rowsUpdated = stmtDeleteByTimezoneIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:helma.objectmodel.db.NodeManager.java
private void setStatementValue(PreparedStatement stmt, int stmtNumber, Property p, int columnType) throws SQLException { if (p.getValue() == null) { stmt.setNull(stmtNumber, columnType); } else {/* w w w . j av a2s .co m*/ switch (columnType) { case Types.BIT: case Types.BOOLEAN: stmt.setBoolean(stmtNumber, p.getBooleanValue()); break; case Types.TINYINT: case Types.BIGINT: case Types.SMALLINT: case Types.INTEGER: stmt.setLong(stmtNumber, p.getIntegerValue()); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: case Types.NUMERIC: case Types.DECIMAL: stmt.setDouble(stmtNumber, p.getFloatValue()); break; case Types.LONGVARBINARY: case Types.VARBINARY: case Types.BINARY: case Types.BLOB: Object b = p.getJavaObjectValue(); if (b instanceof byte[]) { byte[] buf = (byte[]) b; try { stmt.setBytes(stmtNumber, buf); } catch (SQLException x) { ByteArrayInputStream bout = new ByteArrayInputStream(buf); stmt.setBinaryStream(stmtNumber, bout, buf.length); } } else { throw new SQLException( "expected byte[] for binary column '" + p.getName() + "', found " + b.getClass()); } break; case Types.LONGVARCHAR: try { stmt.setString(stmtNumber, p.getStringValue()); } catch (SQLException x) { String str = p.getStringValue(); Reader r = new StringReader(str); stmt.setCharacterStream(stmtNumber, r, str.length()); } break; case Types.CLOB: String val = p.getStringValue(); Reader isr = new StringReader(val); stmt.setCharacterStream(stmtNumber, isr, val.length()); break; case Types.CHAR: case Types.VARCHAR: case Types.OTHER: stmt.setString(stmtNumber, p.getStringValue()); break; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: stmt.setTimestamp(stmtNumber, p.getTimestampValue()); break; case Types.NULL: stmt.setNull(stmtNumber, 0); break; default: stmt.setString(stmtNumber, p.getStringValue()); break; } } }
From source file:org.apache.openjpa.jdbc.sql.DBDictionary.java
/** * Return the preferred {@link Types} constant for the given * {@link JavaTypes} or {@link JavaSQLTypes} constant. */// w w w . j av a 2s. co m public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale) { if (lob) { switch (metaTypeCode) { case JavaTypes.STRING: case JavaSQLTypes.ASCII_STREAM: case JavaSQLTypes.CHAR_STREAM: return getPreferredType(Types.CLOB); default: return getPreferredType(Types.BLOB); } } switch (metaTypeCode) { case JavaTypes.BOOLEAN: case JavaTypes.BOOLEAN_OBJ: return getPreferredType(Types.BIT); case JavaTypes.BYTE: case JavaTypes.BYTE_OBJ: return getPreferredType(Types.TINYINT); case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: if (storeCharsAsNumbers) return getPreferredType(Types.INTEGER); return getPreferredType(Types.CHAR); case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: if (precis > 0 || scale > 0) { return getPreferredType(Types.NUMERIC); } else { return getPreferredType(Types.DOUBLE); } case JavaTypes.FLOAT: case JavaTypes.FLOAT_OBJ: if (precis > 0 || scale > 0) { return getPreferredType(Types.NUMERIC); } else { return getPreferredType(Types.REAL); } case JavaTypes.INT: case JavaTypes.INT_OBJ: return getPreferredType(Types.INTEGER); case JavaTypes.LONG: case JavaTypes.LONG_OBJ: return getPreferredType(Types.BIGINT); case JavaTypes.SHORT: case JavaTypes.SHORT_OBJ: return getPreferredType(Types.SMALLINT); case JavaTypes.STRING: case JavaTypes.LOCALE: case JavaSQLTypes.ASCII_STREAM: case JavaSQLTypes.CHAR_STREAM: return getPreferredType(Types.VARCHAR); case JavaTypes.BIGINTEGER: if (storeLargeNumbersAsStrings) return getPreferredType(Types.VARCHAR); return getPreferredType(Types.BIGINT); case JavaTypes.BIGDECIMAL: if (storeLargeNumbersAsStrings) return getPreferredType(Types.VARCHAR); return getPreferredType(Types.NUMERIC); case JavaTypes.NUMBER: if (storeLargeNumbersAsStrings) return getPreferredType(Types.VARCHAR); return getPreferredType(Types.NUMERIC); case JavaTypes.CALENDAR: case JavaTypes.DATE: return getPreferredType(Types.TIMESTAMP); case JavaSQLTypes.SQL_ARRAY: return getPreferredType(Types.ARRAY); case JavaSQLTypes.BINARY_STREAM: case JavaSQLTypes.BLOB: case JavaSQLTypes.BYTES: return getPreferredType(Types.BLOB); case JavaSQLTypes.CLOB: return getPreferredType(Types.CLOB); case JavaSQLTypes.SQL_DATE: return getPreferredType(Types.DATE); case JavaSQLTypes.TIME: return getPreferredType(Types.TIME); case JavaSQLTypes.TIMESTAMP: return getPreferredType(Types.TIMESTAMP); default: return getPreferredType(Types.BLOB); } }