List of usage examples for java.sql Types BIGINT
int BIGINT
To view the source code for java.sql Types BIGINT.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT
.
From source file:com.mmnaseri.dragonfly.metadata.impl.AnnotationTableMetadataResolver.java
private static int getColumnType(Class<?> javaType, Method method, ColumnMetadata foreignReference) { final int dimensions = ReflectionUtils.getArrayDimensions(javaType); javaType = ReflectionUtils.mapType(ReflectionUtils.getComponentType(javaType)); if (dimensions > 1) { throw new UnsupportedColumnTypeError("Arrays of dimension > 1 are not supported"); }// w w w .j a v a2s . c om if (Byte.class.equals(javaType) && dimensions == 0) { return Types.TINYINT; } else if (Short.class.equals(javaType)) { return Types.SMALLINT; } else if (Integer.class.equals(javaType)) { return Types.INTEGER; } else if (Long.class.equals(javaType)) { return Types.BIGINT; } else if (Float.class.equals(javaType)) { return Types.FLOAT; } else if (Double.class.equals(javaType)) { return Types.DOUBLE; } else if (BigDecimal.class.equals(javaType)) { return Types.DECIMAL; } else if (BigInteger.class.equals(javaType)) { return Types.NUMERIC; } else if (Character.class.equals(javaType)) { return Types.CHAR; } else if (String.class.equals(javaType) || Class.class.equals(javaType)) { if (method != null && method.isAnnotationPresent(Column.class) && method.getAnnotation(Column.class).length() > 0) { return Types.VARCHAR; } else { return Types.LONGVARCHAR; } } else if (Date.class.isAssignableFrom(javaType)) { if (javaType.equals(java.sql.Date.class)) { return Types.DATE; } else if (javaType.equals(Time.class)) { return Types.TIME; } else if (javaType.equals(java.sql.Timestamp.class)) { return Types.TIMESTAMP; } final TemporalType temporalType = method != null && method.isAnnotationPresent(Temporal.class) ? method.getAnnotation(Temporal.class).value() : null; return (temporalType == null || temporalType.equals(TemporalType.TIMESTAMP)) ? Types.TIMESTAMP : (temporalType.equals(TemporalType.DATE) ? Types.DATE : Types.TIME); } else if (Byte.class.equals(javaType) && dimensions > 0) { return Types.VARBINARY; } else if (Enum.class.isAssignableFrom(javaType)) { return Types.VARCHAR; } else if (Boolean.class.equals(javaType)) { return Types.BOOLEAN; } else if (Collection.class.isAssignableFrom(javaType) && method.isAnnotationPresent(BasicCollection.class)) { return Types.LONGVARCHAR; } if (foreignReference != null) { return Integer.MIN_VALUE; } return Types.LONGVARCHAR; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountConfigTable.java
public CFAccAccountConfigBuff[] readBuffByCustCtcLstIdx(CFAccAuthorization Authorization, Long CustContactListTenantId, Long CustContactListId) { final String S_ProcName = "readBuffByCustCtcLstIdx"; ResultSet resultSet = null;/*www. j a v a 2s . com*/ try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_acct_cfg_by_custctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByCustCtcLstIdx == null) { stmtReadBuffByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CustContactListTenantId != null) { stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, CustContactListTenantId.longValue()); } else { stmtReadBuffByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (CustContactListId != null) { stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, CustContactListId.longValue()); } else { stmtReadBuffByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtReadBuffByCustCtcLstIdx.executeQuery(); List<CFAccAccountConfigBuff> buffList = new LinkedList<CFAccAccountConfigBuff>(); while (resultSet.next()) { CFAccAccountConfigBuff buff = unpackAccountConfigResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountConfigBuff[] retBuff = new CFAccAccountConfigBuff[buffList.size()]; Iterator<CFAccAccountConfigBuff> 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.CFAccPgSql.CFAccPgSqlAccountConfigTable.java
public CFAccAccountConfigBuff[] readBuffByCustCtcLstIdx(CFAccAuthorization Authorization, Long CustContactListTenantId, Long CustContactListId) { final String S_ProcName = "readBuffByCustCtcLstIdx"; ResultSet resultSet = null;/* w ww . j a v a 2s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerSchemaDbName() + ".sp_read_acct_cfg_by_custctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByCustCtcLstIdx == null) { stmtReadBuffByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CustContactListTenantId != null) { stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, CustContactListTenantId.longValue()); } else { stmtReadBuffByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (CustContactListId != null) { stmtReadBuffByCustCtcLstIdx.setLong(argIdx++, CustContactListId.longValue()); } else { stmtReadBuffByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtReadBuffByCustCtcLstIdx.executeQuery(); List<CFAccAccountConfigBuff> buffList = new LinkedList<CFAccAccountConfigBuff>(); while (resultSet.next()) { CFAccAccountConfigBuff buff = unpackAccountConfigResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountConfigBuff[] retBuff = new CFAccAccountConfigBuff[buffList.size()]; Iterator<CFAccAccountConfigBuff> 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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnHeadTable.java
public void deleteEnHeadByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnHeadByScopeIdx"; ResultSet resultSet = null;//from w w w . ja v a 2 s. co m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enhead_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnWordTable.java
public void deleteEnWordByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnWordByScopeIdx"; ResultSet resultSet = null;/* w w w . j av a2 s. c o m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enword_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnTenseTable.java
public void deleteEnTenseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnTenseByScopeIdx"; ResultSet resultSet = null;//w w w.jav a 2 s. c o m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_entense_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnObjectTable.java
public void deleteEnObjectByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnObjectByScopeIdx"; ResultSet resultSet = null;// w w w .ja va 2s . c o m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enobj_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.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:org.openmrs.module.sync.api.db.hibernate.HibernateSyncDAO.java
public void exportChildDB(String uuidForChild, OutputStream os) throws DAOException { PrintStream out = new PrintStream(os); Set<String> tablesToSkip = new HashSet<String>(); {// w w w . ja v a 2 s .co m tablesToSkip.add("hl7_in_archive"); tablesToSkip.add("hl7_in_queue"); tablesToSkip.add("hl7_in_error"); tablesToSkip.add("formentry_archive"); tablesToSkip.add("formentry_queue"); tablesToSkip.add("formentry_error"); tablesToSkip.add("sync_class"); tablesToSkip.add("sync_import"); tablesToSkip.add("sync_record"); tablesToSkip.add("sync_server"); tablesToSkip.add("sync_server_class"); tablesToSkip.add("sync_server_record"); // TODO: figure out which other tables to skip // tablesToSkip.add("obs"); // tablesToSkip.add("concept"); // tablesToSkip.add("patient"); } List<String> tablesToDump = new ArrayList<String>(); Session session = sessionFactory.getCurrentSession(); String schema = (String) session.createSQLQuery("SELECT schema()").uniqueResult(); log.warn("schema: " + schema); // Get all tables that we'll need to dump { Query query = session.createSQLQuery( "SELECT tabs.table_name FROM INFORMATION_SCHEMA.TABLES tabs WHERE tabs.table_schema = '" + schema + "'"); for (Object tn : query.list()) { String tableName = (String) tn; if (!tablesToSkip.contains(tableName.toLowerCase())) tablesToDump.add(tableName); } } log.warn("tables to dump: " + tablesToDump); String thisServerGuid = getGlobalProperty(SyncConstants.PROPERTY_SERVER_UUID); // Write the DDL Header as mysqldump does { out.println("-- ------------------------------------------------------"); out.println("-- Database dump to create an openmrs child server"); out.println("-- Schema: " + schema); out.println("-- Parent GUID: " + thisServerGuid); out.println("-- Parent version: " + OpenmrsConstants.OPENMRS_VERSION); out.println("-- ------------------------------------------------------"); out.println(""); out.println("/*!40101 SET CHARACTER_SET_CLIENT=utf8 */;"); out.println("/*!40101 SET NAMES utf8 */;"); out.println("/*!40103 SET TIME_ZONE='+00:00' */;"); out.println("/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"); out.println("/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"); out.println("/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"); out.println("/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;"); out.println("/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;"); out.println("/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;"); out.println("/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;"); out.println("/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;"); out.println(""); } try { // JDBC way of doing this // Connection conn = // DriverManager.getConnection("jdbc:mysql://localhost/" + schema, // "test", "test"); Connection conn = sessionFactory.getCurrentSession().connection(); try { Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); // Get the create database statement ResultSet rs = st.executeQuery("SHOW CREATE DATABASE " + schema); for (String tableName : tablesToDump) { out.println(); out.println("--"); out.println("-- Table structure for table `" + tableName + "`"); out.println("--"); out.println("DROP TABLE IF EXISTS `" + tableName + "`;"); out.println("SET @saved_cs_client = @@character_set_client;"); out.println("SET character_set_client = utf8;"); rs = st.executeQuery("SHOW CREATE TABLE " + tableName); while (rs.next()) { out.println(rs.getString("Create Table") + ";"); } out.println("SET character_set_client = @saved_cs_client;"); out.println(); { out.println("-- Dumping data for table `" + tableName + "`"); out.println("LOCK TABLES `" + tableName + "` WRITE;"); out.println("/*!40000 ALTER TABLE `" + tableName + "` DISABLE KEYS */;"); boolean first = true; rs = st.executeQuery("select * from " + tableName); ResultSetMetaData md = rs.getMetaData(); int numColumns = md.getColumnCount(); int rowNum = 0; boolean insert = false; while (rs.next()) { if (rowNum == 0) { insert = true; out.print("INSERT INTO `" + tableName + "` VALUES "); } ++rowNum; if (first) { first = false; } else { out.print(", "); } if (rowNum % 20 == 0) { out.println(); } out.print("("); for (int i = 1; i <= numColumns; ++i) { if (i != 1) { out.print(","); } if (rs.getObject(i) == null) { out.print("NULL"); } else { switch (md.getColumnType(i)) { case Types.VARCHAR: case Types.CHAR: case Types.LONGVARCHAR: out.print("'"); out.print( rs.getString(i).replaceAll("\n", "\\\\n").replaceAll("'", "\\\\'")); out.print("'"); break; case Types.BIGINT: case Types.DECIMAL: case Types.NUMERIC: out.print(rs.getBigDecimal(i)); break; case Types.BIT: out.print(rs.getBoolean(i)); break; case Types.INTEGER: case Types.SMALLINT: case Types.TINYINT: out.print(rs.getInt(i)); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: out.print(rs.getDouble(i)); break; case Types.BLOB: case Types.VARBINARY: case Types.LONGVARBINARY: Blob blob = rs.getBlob(i); out.print("'"); InputStream in = blob.getBinaryStream(); while (true) { int b = in.read(); if (b < 0) { break; } char c = (char) b; if (c == '\'') { out.print("\'"); } else { out.print(c); } } out.print("'"); break; case Types.CLOB: out.print("'"); out.print( rs.getString(i).replaceAll("\n", "\\\\n").replaceAll("'", "\\\\'")); out.print("'"); break; case Types.DATE: out.print("'" + rs.getDate(i) + "'"); break; case Types.TIMESTAMP: out.print("'" + rs.getTimestamp(i) + "'"); break; default: throw new RuntimeException("TODO: handle type code " + md.getColumnType(i) + " (name " + md.getColumnTypeName(i) + ")"); } } } out.print(")"); } if (insert) { out.println(";"); insert = false; } out.println("/*!40000 ALTER TABLE `" + tableName + "` ENABLE KEYS */;"); out.println("UNLOCK TABLES;"); out.println(); } } } finally { conn.close(); } // Now we mark this as a child out.println("-- Now mark this as a child database"); if (uuidForChild == null) uuidForChild = SyncUtil.generateUuid(); out.println("update global_property set property_value = '" + uuidForChild + "' where property = '" + SyncConstants.PROPERTY_SERVER_UUID + "';"); // Write the footer of the DDL script { out.println("/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;"); out.println("/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;"); out.println("/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;"); out.println("/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;"); out.println("/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;"); out.println("/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;"); out.println("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;"); out.println("/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;"); } out.flush(); out.close(); } catch (IOException ex) { log.error("IOException", ex); } catch (SQLException ex) { log.error("SQLException", ex); } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnClauseTable.java
public void deleteEnClauseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnClauseByScopeIdx"; ResultSet resultSet = null;/*from w ww .j a v a 2s .co m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enclause_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnPhraseTable.java
public void deleteEnPhraseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnPhraseByScopeIdx"; ResultSet resultSet = null;// www .j av a 2 s .co m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enphrase_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }