Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public JDBCPreparedStatement(JDBCConnection conn, String sql, java.util.Calendar calendar, String statementName, String cursorName, int rpbID) throws SQLException
        public JDBCPreparedStatement(JDBCConnection conn, string sql, DateTime calendar, string statementName, string cursorName, int rpbID) : base(conn, statementName, cursorName, rpbID)
        {
            poolable_ = true;
            if (string.ReferenceEquals(sql, null))
            {
                JDBCError.throwSQLException(JDBCError.EXC_SYNTAX_ERROR);
                return;
            }
            rsmd_ = null;
            // Check for null statement

            DatabaseRequestAttributes dpa = new DatabaseRequestAttributes();

            //    dpa.setDescribeOption(0xD5); // Name/alias.
            //
            // Only set the statement name and cursor name in the RPB
            //
            sqlStatementType_ = JDBCStatement.getStatementType(sql);

            statementAttributes_.SQLStatementType = sqlStatementType_;

            dpa.SQLStatementType = sqlStatementType_;
            dpa.PrepareOption    = 0;      // Normal prepare.
            if (sqlStatementType_ == JDBCStatement.TYPE_SELECT)
            {                              // Only set for select statement
                dpa.OpenAttributes = 0x80; // Read only. Otherwise blocking doesn't work.
            }

            JDBCParameterMetaData pmd = new JDBCParameterMetaData(calendar);
            string catalog            = conn_.Catalog;
            // Getting the catalog may change the current rpb for the connection.
            // Reset it after getting back.  Otherwise the call to
            // prepareAndDescribe may fail with a PWS0001

            DatabaseConnection databaseConn = conn_.DatabaseConnection;

            databaseConn.CurrentRequestParameterBlockID = rpbID_;
            rsmd_ = new JDBCResultSetMetaData(conn.DatabaseInfo.ServerCCSID, calendar, catalog);

            dpa.ExtendedSQLStatementText = sql;
            conn.prepareAndDescribe(dpa, rsmd_, pmd);

            int handle = -1;
            // Only change the descriptor if there are parameters available
            DatabaseChangeDescriptorAttributes cda = (DatabaseChangeDescriptorAttributes)dpa;

            sbyte[] b = pmd.ExtendedSQLParameterMarkerDataFormat;
            cda.ExtendedSQLParameterMarkerDataFormat = b;
            handle = b == null ? -1 : conn.NextDescriptorHandle;
            if (handle >= 0)
            {
                conn.changeDescriptor(cda, handle);
            }


            pmd_              = pmd;
            pmd_.Statement    = this;
            descriptorHandle_ = handle;
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void prepareAndDescribe(DatabaseRequestAttributes attribs, DatabaseDescribeCallback listener, JDBCParameterMetaData pmd) throws SQLException
        internal virtual void prepareAndDescribe(DatabaseRequestAttributes attribs, DatabaseDescribeCallback listener, JDBCParameterMetaData pmd)
        {
            try
            {
                conn_.prepareAndDescribe(attribs, listener, pmd);
            }
            catch (IOException io)
            {
                throw convertException(io);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void createRequestParameterBlock(DatabaseRequestAttributes rpb, int rpbId) throws SQLException
        internal virtual void createRequestParameterBlock(DatabaseRequestAttributes rpb, int rpbId)
        {
            try
            {
                conn_.createRequestParameterBlock(rpb, rpbId);
            }
            catch (IOException io)
            {
                throw convertException(io);
            }
        }
Example #4
0
        internal bool poolable_        = false; // Default is false

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public JDBCStatement(JDBCConnection conn, String statementName, String cursorName, int rpbID) throws SQLException
        public JDBCStatement(JDBCConnection conn, string statementName, string cursorName, int rpbID)
        {
            cursorName_    = cursorName;
            statementName_ = statementName;
            if (rpbID != 0)
            {
                DatabaseRequestAttributes rpb = new DatabaseRequestAttributes();
                rpb.CursorName           = cursorName;
                rpb.PrepareStatementName = statementName;
                conn.createRequestParameterBlock(rpb, rpbID);
                attribs_             = rpb;
                statementAttributes_ = rpb.copy();
            }
            conn_  = conn;
            rpbID_ = rpbID;
        }
        public virtual DatabaseRequestAttributes copy()
        {
            DatabaseRequestAttributes newCopy = new DatabaseRequestAttributes();

            newCopy.cursorName_                      = cursorName_;
            newCopy.reuseIndicator_                  = reuseIndicator_;
            newCopy.reuseIndicatorSet_               = reuseIndicatorSet_;
            newCopy.translateIndicator_              = translateIndicator_;
            newCopy.translateIndicatorSet_           = translateIndicatorSet_;
            newCopy.rleCompressedFunctionParameters_ = rleCompressedFunctionParameters_;
            newCopy.blockingFactor_                  = blockingFactor_;
            newCopy.blockingFactorSet_               = blockingFactorSet_;
            newCopy.fetchScrollOption_               = fetchScrollOption_;
            newCopy.fetchScrollOptionRelativeValue_  = fetchScrollOptionRelativeValue_;
            newCopy.fetchScrollOptionSet_            = fetchScrollOptionSet_;
            newCopy.fetchBufferSize_                 = fetchBufferSize_;
            newCopy.fetchBufferSizeSet_              = fetchBufferSizeSet_;

            newCopy.packageLibrary_                         = packageLibrary_;
            newCopy.packageName_                            = packageName_;
            newCopy.prepareStatementName_                   = prepareStatementName_;
            newCopy.sqlStatementText_                       = sqlStatementText_;
            newCopy.prepareOption_                          = prepareOption_;
            newCopy.prepareOptionSet_                       = prepareOptionSet_;
            newCopy.openAttributes_                         = openAttributes_;
            newCopy.openAttributesSet_                      = openAttributesSet_;
            newCopy.describeOption_                         = describeOption_;
            newCopy.describeOptionSet_                      = describeOptionSet_;
            newCopy.scrollableCursorFlag_                   = scrollableCursorFlag_;
            newCopy.scrollableCursorFlagSet_                = scrollableCursorFlagSet_;
            newCopy.holdIndicator_                          = holdIndicator_;
            newCopy.holdIndicatorSet_                       = holdIndicatorSet_;
            newCopy.sqlStatementType_                       = sqlStatementType_;
            newCopy.sqlStatementTypeSet_                    = sqlStatementTypeSet_;
            newCopy.sqlParameterMarkerBlockIndicator_       = sqlParameterMarkerBlockIndicator_;
            newCopy.sqlParameterMarkerBlockIndicatorSet_    = sqlParameterMarkerBlockIndicatorSet_;
            newCopy.queryTimeoutLimit_                      = queryTimeoutLimit_;
            newCopy.queryTimeoutLimitSet_                   = queryTimeoutLimitSet_;
            newCopy.serverSideStaticCursorResultSetSize_    = serverSideStaticCursorResultSetSize_;
            newCopy.serverSideStaticCursorResultSetSizeSet_ = serverSideStaticCursorResultSetSizeSet_;
            newCopy.extendedColumnDescriptorOption_         = extendedColumnDescriptorOption_;
            newCopy.extendedColumnDescriptorOptionSet_      = extendedColumnDescriptorOptionSet_;
            newCopy.resultSetHoldabilityOption_             = resultSetHoldabilityOption_;
            newCopy.resultSetHoldabilityOptionSet_          = resultSetHoldabilityOptionSet_;
            newCopy.extendedSQLStatementText_               = extendedSQLStatementText_;
            newCopy.variableFieldCompression_               = variableFieldCompression_;
            newCopy.variableFieldCompressionSet_            = variableFieldCompressionSet_;
            newCopy.returnOptimisticLockingColumns_         = returnOptimisticLockingColumns_;
            newCopy.returnOptimisticLockingColumnsSet_      = returnOptimisticLockingColumnsSet_;

            newCopy.returnSize_    = returnSize_;
            newCopy.returnSizeSet_ = returnSizeSet_;

            newCopy.sqlParameterMarkerData_         = sqlParameterMarkerData_;
            newCopy.sqlExtendedParameterMarkerData_ = sqlExtendedParameterMarkerData_;

            newCopy.sqlParameterMarkerDataFormat_         = sqlParameterMarkerDataFormat_;
            newCopy.extendedSQLParameterMarkerDataFormat_ = extendedSQLParameterMarkerDataFormat_;

            newCopy.syncPointCount_    = syncPointCount_;
            newCopy.syncPointCountSet_ = syncPointCountSet_;

            newCopy.lobLocatorHandle_                = lobLocatorHandle_;
            newCopy.lobLocatorHandleSet_             = lobLocatorHandleSet_;
            newCopy.requestedSize_                   = requestedSize_;
            newCopy.requestedSizeSet_                = requestedSizeSet_;
            newCopy.startOffset_                     = startOffset_;
            newCopy.startOffsetSet_                  = startOffsetSet_;
            newCopy.compressionIndicator_            = compressionIndicator_;
            newCopy.compressionIndicatorSet_         = compressionIndicatorSet_;
            newCopy.returnCurrentLengthIndicator_    = returnCurrentLengthIndicator_;
            newCopy.returnCurrentLengthIndicatorSet_ = returnCurrentLengthIndicatorSet_;
            newCopy.columnIndex_                     = columnIndex_;
            newCopy.columnIndexSet_                  = columnIndexSet_;
            return(newCopy);
        }