Package org.apache.derby.iapi.sql

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


    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() > 128)
        throw StandardException.newException(SQLState.LANG_DB2_REPLACEMENT_ERROR, "CURRENT SCHEMA");
    }
View Full Code Here

       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
       */
      rePrepare(lccToUse);

 
View Full Code Here

      }

      /*
      ** Get the row and set the parameters based on that
      */
      ParameterValueSet params = lcc.getLanguageFactory().newParameterValueSet(
        lcc.getLanguageConnectionFactory().getClassFactory().getClassInspector(), types.length, false);

      DataValueDescriptor[] rowArray = row.getRowArray();
      // Check at compile time that the using clause has the correct number of parameters.
      if (rowArray.length != types.length) {
        throw StandardException.newException(SQLState.LANG_NUM_PARAMS_INCORRECT,
          Integer.toString(rowArray.length), Integer.toString(types.length));
      }

      for (int i = 0; i < types.length; i++)
      {
        TypeId typeId = types[i].getTypeId();

        params.setStorableDataValue(
          typeId.getNull(),
          i, typeId.getJDBCTypeId(), typeId.getCorrespondingJavaTypeName());

        params.getParameterForSet(i).setValue(rowArray[i]);
      }

      /*
      ** If there are any other rows, then throw an
      ** exception
      */
      if (rs.getNextRow() != null)
      {
        throw StandardException.newException(SQLState.LANG_USING_CARDINALITY_VIOLATION);
      }
      //bug 4552 - "exec statement using" will return no parameters through parametermetadata
      params.setUsingParameterValueSet();

      /*
      ** Stash the parameters in the compiler context
      */ 
      getCompilerContext().setParams(params);
View Full Code Here

  }

  /** @see CompilerContext#getParams */
  public ParameterValueSet getParams()
  {
    ParameterValueSet tmpParams = this.params;
    this.params = null;
    return tmpParams;
  }
View Full Code Here

  /**
    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

       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

      }
    }

  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

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

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

    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

TOP

Related Classes of org.apache.derby.iapi.sql.ParameterValueSet

Copyright © 2018 www.massapicom. 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.