Package org.apache.derby.iapi.sql.dictionary

Examples of org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList


        conglomNumbers = new long[size];
        isSelfReferencingFK = new boolean[size];
        raRules = new int[size];
        ForeignKeyConstraintDescriptor fkcd = null;
        TableDescriptor fktd;
        ColumnDescriptorList coldl;
        int[] refColumns;
        ColumnDescriptor cold;
        int[] colArray = remapReferencedColumns(cd, rowMap);
        for (int inner = 0; inner < size; inner++)
        {
          fkcd = (ForeignKeyConstraintDescriptor) fkcdl.elementAt(inner);
          fkSetupArrays(dd, fkcd,
                inner, uuids, conglomNumbers, fkNames,
                isSelfReferencingFK, raRules);
          if((raRules[inner] == StatementType.RA_CASCADE) ||
             (raRules[inner] ==StatementType.RA_SETNULL))
          {
            //find  the referencing  table Name
            fktd = fkcd.getTableDescriptor();
            refTableNames.addElement(fktd.getSchemaName() + "." + fktd.getName());
            refActions.addElement(new Integer(raRules[inner]));
            //find the referencing column name required for update null.
            refColumns = fkcd.getReferencedColumns();
            coldl = fktd.getColumnDescriptorList();
            ColumnDescriptorList releventColDes = new ColumnDescriptorList();
            for(int i = 0 ; i < refColumns.length; i++)
            {
              cold =(ColumnDescriptor)coldl.elementAt(refColumns[i]-1);
              releventColDes.add(cold);
            }
            refColDescriptors.addElement(releventColDes);
            refIndexConglomNum.addElement(new Long(conglomNumbers[inner]));
            fkColMap.addElement(colArray);
          }
View Full Code Here


    ** turn them into an RCL that we can run with.
    */
    resultColumns = (ResultColumnList) getNodeFactory().getNode(
                      C_NodeTypes.RESULT_COLUMN_LIST,
                      getContextManager());
    ColumnDescriptorList cdl = td.getColumnDescriptorList();
    int           cdlSize = cdl.size();

    for (int index = 0; index < cdlSize; index++)
    {
      /* Build a ResultColumn/BaseColumnNode pair for the column */
      ColumnDescriptor colDesc = (ColumnDescriptor) cdl.elementAt(index);

      BaseColumnNode bcn = (BaseColumnNode) getNodeFactory().getNode(
                      C_NodeTypes.BASE_COLUMN_NODE,
                      colDesc.getColumnName(),
                        exposedTableName,
View Full Code Here

    /* Add all of the columns in the table */
    rcList = (ResultColumnList) getNodeFactory().getNode(
                    C_NodeTypes.RESULT_COLUMN_LIST,
                    getContextManager());
    ColumnDescriptorList cdl = td.getColumnDescriptorList();
    int           cdlSize = cdl.size();

    for (int index = 0; index < cdlSize; index++)
    {
      /* Build a ResultColumn/BaseColumnNode pair for the column */
      colDesc = (ColumnDescriptor) cdl.elementAt(index);

      valueNode = (ValueNode) getNodeFactory().getNode(
                      C_NodeTypes.BASE_COLUMN_NODE,
                      colDesc.getColumnName(),
                        exposedName,
View Full Code Here

        //
        // Add generated columns whose generation clauses mention columns
        // in the user's original update list.
        //
        ColumnDescriptorList    addedGeneratedColumns = new ColumnDescriptorList();
        ColumnDescriptorList    affectedGeneratedColumns = new ColumnDescriptorList();
        addGeneratedColumns
            ( targetTableDescriptor, resultSet, affectedGeneratedColumns, addedGeneratedColumns );
       
    /*
    ** The current result column list is the one supplied by the user.
View Full Code Here

  )
    throws StandardException
  {
        ResultColumnList        updateColumnList = updateSet.getResultColumns();
        int                             count = updateColumnList.size();
        ColumnDescriptorList    generatedColumns = baseTable.getGeneratedColumns();
        int                                 generatedColumnCount = generatedColumns.size();
    int                            columnCount = baseTable.getMaxColumnID();
        HashSet                     updatedColumns = new HashSet();
        UUID                            tableID = baseTable.getObjectID();
       
    for (int ix = 0; ix < count; ix++)
    {
      String      name = ((ResultColumn)updateColumnList.elementAt( ix )).getName();

            updatedColumns.add( name );
    }

        for ( int gcIdx = 0; gcIdx < generatedColumnCount; gcIdx++ )
        {
            ColumnDescriptor    gc = generatedColumns.elementAt( gcIdx );
            DefaultInfo             defaultInfo = gc.getDefaultInfo();
            String[]                       mentionedColumnNames = defaultInfo.getReferencedColumnNames();
            int                         mentionedColumnCount = mentionedColumnNames.length;

            // handle the case of setting a generated column to the DEFAULT
View Full Code Here

    /* Add all of the columns in the table */
    rcList = (ResultColumnList) getNodeFactory().getNode(
                    C_NodeTypes.RESULT_COLUMN_LIST,
                    getContextManager());
    ColumnDescriptorList cdl = tableDescriptor.getColumnDescriptorList();
    int           cdlSize = cdl.size();

    for (int index = 0; index < cdlSize; index++)
    {
      /* Build a ResultColumn/BaseColumnNode pair for the column */
      colDesc = (ColumnDescriptor) cdl.elementAt(index);
      //A ColumnDescriptor instantiated through SYSCOLUMNSRowFactory only has
      //the uuid set on it and no table descriptor set on it. Since we know here
      //that this columnDescriptor is tied to tableDescriptor, set it so using
      //setTableDescriptor method. ColumnDescriptor's table descriptor is used
      //to get ResultSetMetaData.getTableName & ResultSetMetaData.getSchemaName
View Full Code Here

    /* Add all of the columns in the table */
    ResultColumnList newRcl = (ResultColumnList) getNodeFactory().getNode(
                        C_NodeTypes.RESULT_COLUMN_LIST,
                        getContextManager());
    ColumnDescriptorList cdl = tableDescriptor.getColumnDescriptorList();
    int           cdlSize = cdl.size();

    for (int index = 0; index < cdlSize; index++)
    {
      /* Build a ResultColumn/BaseColumnNode pair for the column */
      cd = (ColumnDescriptor) cdl.elementAt(index);
      int position = cd.getPosition();

      if (!colsWeWant.get(position))
      {
        continue;
View Full Code Here

    originalRCS = getSortedByPosition();

    posn = 0;
    /* Iterate through the ColumnDescriptors for the given table */
    ColumnDescriptorList cdl = td.getColumnDescriptorList();
    int           cdlSize = cdl.size();

    for (int index = 0; index < cdlSize; index++)
    {
      cd = (ColumnDescriptor) cdl.elementAt(index);

      if ((posn < originalRCS.length) &&
        (cd.getPosition() == originalRCS[posn].getColumnPosition()))
      {
        rc = originalRCS[posn];
View Full Code Here

                      ColumnDescriptorList   cdl,
                      TupleDescriptor     td)
      throws StandardException
  {
    ColumnDescriptor    cd;
    ColumnDescriptorList    cdlCopy         = new ColumnDescriptorList();
    DataValueDescriptor    refIDOrderable  = null;
    TabInfoImpl                 ti              = coreInfo[SYSCOLUMNS_CORE_NUM];

    /* Use refIDOrderable in both start and stop position for scan. */
    refIDOrderable = getIDValueAsCHAR(uuid);

    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, refIDOrderable);

    getDescriptorViaIndex(
            SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
            td,
            (ColumnDescriptorList) cdl,
            false);

    /* The TableDescriptor's column descriptor list must be ordered by
     * columnNumber.  (It is probably not ordered correctly at this point due
     * to the index on syscolumns being on (tableId, columnName).)  The
     * cheapest way to reorder the list appears to be to copy it (above), and then
     * walk the copy and put the elements back into the original in the
     * expected locations.
     */
    int cdlSize = cdl.size();
    for (int index = 0; index < cdlSize; index++)
    {
      cdlCopy.add( cdl.get(index));
    }
    for (int index = 0; index < cdlSize; index++)
    {
      cd = (ColumnDescriptor) cdlCopy.elementAt(index);
      cdl.set(cd.getPosition() - 1, cd);
    }
  }
View Full Code Here

   * @exception StandardException    Thrown on error
   */
  public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, Vector defaults)
    throws StandardException
  {
    ColumnDescriptorList cdl = new ColumnDescriptorList();
    getColumnDescriptorsScan(spsd.getUUID(), cdl, spsd);

    int cdlSize = cdl.size();
    DataTypeDescriptor[] params = new DataTypeDescriptor[cdlSize]
    for (int index = 0; index < cdlSize; index++)
    {
      ColumnDescriptor cd = (ColumnDescriptor) cdl.elementAt(index);
      params[index] = cd.getType();
      if (defaults != null)
      {
        defaults.addElement(cd.getDefaultValue());
      }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList

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.