Example usage for java.sql Types BIGINT

List of usage examples for java.sql Types BIGINT

Introduction

In this page you can find the example usage for java.sql Types BIGINT.

Prototype

int BIGINT

To view the source code for java.sql Types BIGINT.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT.

Usage

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnSubjectTable.java

public void createEnSubject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnSubjectBuff Buff) {
    final String S_ProcName = "createEnSubject";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from ww w.java2s .c  o  m*/
    ResultSet resultSet = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_ensubj( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + " )";
        if (stmtCreateByPKey == null) {
            stmtCreateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        try {
            resultSet = stmtCreateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnSubjectBuff createdBuff = unpackEnSubjectResultSetToBuff(resultSet);
            if ((resultSet != null) && resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredId(createdBuff.getRequiredId());
            Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
            Buff.setRequiredName(createdBuff.getRequiredName());
            Buff.setRequiredRevision(createdBuff.getRequiredRevision());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected a single-record response, " + resultSet.getRow() + " rows selected");
        }
    } 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.CFEnSyntaxOracle.CFEnSyntaxOracleEnObjectTable.java

public void createEnObject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnObjectBuff Buff) {
    final String S_ProcName = "createEnObject";
    ResultSet resultSet = null;/* www. j  a v  a 2s. c  o m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enobj( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enobj() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnObjectBuff createdBuff = unpackEnObjectResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enobj() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

From source file:com.netspective.axiom.sql.QueryResultSet.java

public void fillReportFromMetaData(TabularReport report) throws SQLException {
    ResultSetMetaData rsmd = resultSet.getMetaData();
    int numColumns = rsmd.getColumnCount();

    TabularReportColumns columns = report.getColumns();
    columns.clear();/*ww  w  .  j a v a  2 s  . c o m*/

    for (int c = 1; c <= numColumns; c++) {
        TabularReportColumn column = null;

        int dataType = rsmd.getColumnType(c);
        switch (dataType) {
        case Types.INTEGER:
        case Types.SMALLINT:
        case Types.BIGINT:
        case Types.TINYINT:
        case Types.BIT:
            column = new NumericColumn();
            break;

        case Types.FLOAT:
        case Types.REAL:
            column = new DecimalColumn();
            break;

        case Types.NUMERIC:
        case Types.DECIMAL:
            if (rsmd.getScale(c) > 0)
                column = new DecimalColumn();
            else
                column = new NumericColumn();
            break;

        default:
            column = new GeneralColumn();
            break;
        }

        column.setColIndex(c - 1);
        column.setHeading(new StaticValueSource(
                TextUtils.getInstance().sqlIdentifierToText(rsmd.getColumnLabel(c), true)));
        column.setDataType(dataType);
        column.setWidth(rsmd.getColumnDisplaySize(c));

        columns.add(column);
    }

    report.finalizeContents();
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnClauseTable.java

public void createEnClause(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnClauseBuff Buff) {
    final String S_ProcName = "createEnClause";
    ResultSet resultSet = null;// ww w.  ja v a2  s  .c om
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enclause( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enclause() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnClauseBuff createdBuff = unpackEnClauseResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enclause() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnPhraseTable.java

public void createEnPhrase(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnPhraseBuff Buff) {
    final String S_ProcName = "createEnPhrase";
    ResultSet resultSet = null;/*  w w w . j  a v a2s.  c om*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enphrase( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enphrase() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnPhraseBuff createdBuff = unpackEnPhraseResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enphrase() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnSentenceTable.java

public void createEnSentence(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnSentenceBuff Buff) {
    final String S_ProcName = "createEnSentence";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w ww .j  a va2 s  .co m*/
    ResultSet resultSet = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_ensent( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + " )";
        if (stmtCreateByPKey == null) {
            stmtCreateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        try {
            resultSet = stmtCreateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnSentenceBuff createdBuff = unpackEnSentenceResultSetToBuff(resultSet);
            if ((resultSet != null) && resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredId(createdBuff.getRequiredId());
            Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
            Buff.setRequiredName(createdBuff.getRequiredName());
            Buff.setRequiredRevision(createdBuff.getRequiredRevision());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected a single-record response, " + resultSet.getRow() + " rows selected");
        }
    } 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.CFEnSyntaxMySqlEnModifierTable.java

public void createEnModifier(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnModifierBuff Buff) {
    final String S_ProcName = "createEnModifier";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   w w w.j av a 2 s  .c om
    ResultSet resultSet = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_enmodif( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + " )";
        if (stmtCreateByPKey == null) {
            stmtCreateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        try {
            resultSet = stmtCreateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnModifierBuff createdBuff = unpackEnModifierResultSetToBuff(resultSet);
            if ((resultSet != null) && resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredId(createdBuff.getRequiredId());
            Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
            Buff.setRequiredName(createdBuff.getRequiredName());
            Buff.setRequiredRevision(createdBuff.getRequiredRevision());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected a single-record response, " + resultSet.getRow() + " rows selected");
        }
    } 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.CFEnSyntaxMySqlEnMorphemeTable.java

public void createEnMorpheme(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnMorphemeBuff Buff) {
    final String S_ProcName = "createEnMorpheme";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w  ww . j a  va2 s .  c  o m*/
    ResultSet resultSet = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_enmorph( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + " )";
        if (stmtCreateByPKey == null) {
            stmtCreateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        try {
            resultSet = stmtCreateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnMorphemeBuff createdBuff = unpackEnMorphemeResultSetToBuff(resultSet);
            if ((resultSet != null) && resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredId(createdBuff.getRequiredId());
            Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
            Buff.setRequiredName(createdBuff.getRequiredName());
            Buff.setRequiredRevision(createdBuff.getRequiredRevision());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected a single-record response, " + resultSet.getRow() + " rows selected");
        }
    } 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.CFEnSyntaxOracle.CFEnSyntaxOracleEnSubjectTable.java

public void createEnSubject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnSubjectBuff Buff) {
    final String S_ProcName = "createEnSubject";
    ResultSet resultSet = null;/*from w  ww  .j ava  2  s.  c o m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_ensubj( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_ensubj() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnSubjectBuff createdBuff = unpackEnSubjectResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_ensubj() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnAuxiliaryTable.java

public void createEnAuxiliary(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnAuxiliaryBuff Buff) {
    final String S_ProcName = "createEnAuxiliary";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// w  w w.ja va  2  s .c  o m
    ResultSet resultSet = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_enaux( ?, ?, ?, ?, ?, ?" + ", " + "?"
                + ", " + "?" + " )";
        if (stmtCreateByPKey == null) {
            stmtCreateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        try {
            resultSet = stmtCreateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnAuxiliaryBuff createdBuff = unpackEnAuxiliaryResultSetToBuff(resultSet);
            if ((resultSet != null) && resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredId(createdBuff.getRequiredId());
            Buff.setOptionalScopeId(createdBuff.getOptionalScopeId());
            Buff.setRequiredName(createdBuff.getRequiredName());
            Buff.setRequiredRevision(createdBuff.getRequiredRevision());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected a single-record response, " + resultSet.getRow() + " rows selected");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}