Examples of ParameterValueSet


Examples of org.apache.derby.iapi.sql.ParameterValueSet

    dd = lcc.getDataDictionary();
    String thisSchemaName = schemaName;
    if (type == StatementType.SET_SCHEMA_DYNAMIC)
    {
      ParameterValueSet pvs = activation.getParameterValueSet();
      DataValueDescriptor dvs = pvs.getParameter(0);
      thisSchemaName = dvs.getString();
      //null parameter is not allowed
      if (thisSchemaName == null || thisSchemaName.length() > Limits.MAX_IDENTIFIER_LENGTH)
        throw StandardException.newException(SQLState.LANG_DB2_REPLACEMENT_ERROR, "CURRENT SCHEMA");
    }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

               throw newSQLException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE,
                                     getParameterSQLType(parameterIndex));

        try {
            ReaderToUTF8Stream utfIn;
            ParameterValueSet pvs = getParms();
            // Need column width to figure out if truncation is needed
            DataTypeDescriptor dtd[] = preparedStatement
                    .getParameterTypes();
            int colWidth = dtd[parameterIndex - 1].getMaximumWidth();
            // Default to max column width. This will be used to limit the
            // amount of data read when operating on "lengthless" streams.
            int usableLength = colWidth;

            if (!lengthLess) {
                // We cast the length from long to int. This wouldn't be
                // appropriate if the limit of 2G-1 is decided to be increased
                // at a later stage.
                int intLength = (int)length;
                int truncationLength = 0;

                usableLength = intLength;

                // Currently long varchar does not allow for truncation of
                // trailing blanks.
                // For char and varchar types, current mechanism of
                // materializing when using streams seems fine given their max
                // limits.
                // This change is fix for DERBY-352: Insert of clobs using
                // streams should not materialize the entire stream into memory
                // In case of clobs, the truncation of trailing blanks is
                // factored in when reading from the stream without
                // materializing the entire stream, and so the special casing
                // for clob below.
                if (jdbcTypeId == Types.CLOB)
                {

                    // It is possible that the length of the stream passed in
                    // is greater than the column width, in which case the data
                    // from the stream needs to be truncated.
                    // usableLength is the length of the data from stream that
                    // can be inserted which is min(colWidth,length) provided
                    // length - colWidth has trailing blanks only
                    // we have used intLength into which the length variable had
                    // been cast to an int and stored
                    if (intLength > colWidth) {
                        usableLength = colWidth;
                        truncationLength = intLength - usableLength;
                    }
                }
                // Create a stream with truncation.
                utfIn = new ReaderToUTF8Stream(reader, usableLength,
                        truncationLength, getParameterSQLType(parameterIndex));
            } else {
                // Create a stream without exactness checks,
                // but with a maximum limit.
                utfIn = new ReaderToUTF8Stream(reader, colWidth,
                                getParameterSQLType(parameterIndex));
            }

            // JDBC is one-based, DBMS is zero-based.
            // Note that for lengthless stream, usableLength will be
            // the maximum length for the column.
            // This is okay, based on the observation that
            // setValue does not use the value for anything at all.
            pvs.getParameterForSet(
                parameterIndex - 1).setValue(utfIn, usableLength);

    } catch (StandardException t) {
      throw EmbedResultSet.noStateChangeException(t);
    }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

      }
    }

  boolean executeBatchElement(Object batchElement) throws SQLException, StandardException {
   
    ParameterValueSet temp = (ParameterValueSet) batchElement;

    int numberOfParameters = temp.getParameterCount();

    for (int j=0; j<numberOfParameters; j++) {
      temp.getParameter(j).setInto(this, j + 1);
    }

    return super.executeStatement(activation, false, true);
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

   * @exception SQLException thrown on failure.
     */
    public void clearParameters() throws SQLException {
    checkStatus();

    ParameterValueSet pvs = getParms();
    if (pvs != null)
      pvs.clearParameters();
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

    if (scale < 0)
      throw newSQLException(SQLState.BAD_SCALE_VALUE, new Integer(scale));
   
    try {

      ParameterValueSet pvs = getParms();

      /* JDBC is one-based, DBMS is zero-based */
      DataValueDescriptor value = pvs.getParameter(parameterIndex - 1);


      int origvaluelen = value.getLength();
      ((VariableSizeDataValue)
            value).setWidth(VariableSizeDataValue.IGNORE_PRECISION,
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

        JDBC30Translation.NO_GENERATED_KEYS,
        null,
        null);

    // mark our parameters as for a callable statement
    ParameterValueSet pvs = getParms();

    // do we have a return parameter?
    hasReturnOutputParameter = pvs.hasReturnOutputParameter();
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

    // to ensure we have an activation for the getParams
    checkExecStatus();
    synchronized (getConnectionSynchronization())
    {
      wasNull = false;
      ParameterValueSet pvs = getParms();
      try
      {
        pvs.validate();

      } catch (StandardException e)
      {
        throw EmbedResultSet.noStateChangeException(e);
      }

      /* KLUDGE - ? = CALL ... returns a ResultSet().  We
       * need executeUpdate to be false in that case.
       */
      boolean execResult = super.executeStatement(a, executeQuery,
        (executeUpdate && (! hasReturnOutputParameter)));

      /*
      ** If we have a return parameter, then we
      ** consume it from the returned ResultSet
      ** reset the ResultSet set to null.
      */
      if (hasReturnOutputParameter)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(results!=null, "null results even though we are supposed to have a return parameter");
        }
        boolean gotRow = results.next();
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(gotRow, "the return resultSet didn't have any rows");
        }

        try
        {
          DataValueDescriptor returnValue = pvs.getReturnValueForSet();
          returnValue.setValueFromResultSet(results, 1, true);
        } catch (StandardException e)
        {
          throw EmbedResultSet.noStateChangeException(e);
        }
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

      throw Util.notImplemented();
    }
  public void addBatch() throws SQLException {

    checkStatus();
    ParameterValueSet pvs = getParms();

    int numberOfParameters = pvs.getParameterCount();

    for (int j=1; j<=numberOfParameters; j++) {

      switch (pvs.getParameterMode(j)) {
      case JDBC30Translation.PARAMETER_MODE_IN:
      case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
        break;
      case JDBC30Translation.PARAMETER_MODE_OUT:
      case JDBC30Translation.PARAMETER_MODE_IN_OUT:
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

       if (lccToUse.getLogStatementText())
      {
        HeaderPrintWriter istream = Monitor.getStream();
        String xactId = lccToUse.getTransactionExecute().getActiveStateTxIdString();
        String pvsString = "";
        ParameterValueSet pvs = activation.getParameterValueSet();
        if (pvs != null && pvs.getParameterCount() > 0)
        {
          pvsString = " with " + pvs.getParameterCount() +
              " parameters " + pvs.toString();
        }
        istream.printlnWithHeader(LanguageConnectionContext.xidStr +
                      xactId +
                      "), " +
                      LanguageConnectionContext.lccStr +
                      lccToUse.getInstanceNumber() +
                      "), " +
                      LanguageConnectionContext.dbnameStr +
                      lccToUse.getDbname() +
                      "), " +
                      LanguageConnectionContext.drdaStr +
                      lccToUse.getDrdaID() +
                      "), Executing prepared statement: " +
                      getSource() +
                      " :End prepared statement" +
                      pvsString);
      }

      ParameterValueSet pvs = activation.getParameterValueSet();

      /* put it in try block to unlock the PS in any case
       */
      if (!spsAction) {
      // only re-prepare if this isn't an SPS for a trigger-action;
View Full Code Here

Examples of org.apache.derby.iapi.sql.ParameterValueSet

  /**
    Check to see if a statement requires to be executed via a callable statement.
  */
  void checkRequiresCallableStatement(Activation activation) throws SQLException {

    ParameterValueSet pvs = activation.getParameterValueSet();

    if (pvs == null)
      return;

    if (pvs.checkNoDeclaredOutputParameters()) {
      try {
        activation.close();
      } catch (StandardException se) {
      }
      throw newSQLException(SQLState.REQUIRES_CALLABLE_STATEMENT, SQLText);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.