Examples of CatalogRowFactory


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

                   TransactionController tc)
    throws StandardException
  {
    TabInfoImpl ti =  (catalogNumber < NUM_CORE) ? coreInfo[catalogNumber] :
      getNonCoreTI(catalogNumber);
    CatalogRowFactory crf = ti.getCatalogRowFactory();

    ExecRow[] rl = new ExecRow[td.length];

    for (int index = 0; index < td.length; index++)
    {
      ExecRow row = crf.makeRow(td[index], parent);
      rl[index] = row;
    }

    int insertRetCode = ti.insertRowList( rl, tc );
    if (!allowDuplicates && insertRetCode != TabInfoImpl.ROWNOTDUPLICATE)
View Full Code Here

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

    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    ScanController      scanController = null;
    boolean          foundRow;
    FormatableBitSet          colToCheck = new FormatableBitSet(indexCol);
    CatalogRowFactory    rf = ti.getCatalogRowFactory()

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(indexId >= 0, "code needs to be enhanced"+
        " to support a table scan to find the index id");
    }

    colToCheck.set(indexCol - 1);

    ScanQualifier[][] qualifier = exFactory.getScanQualifier(1);
    qualifier[0][0].setQualifier
        (indexCol - 1,
         schemaIdOrderable,
         Orderable.ORDER_OP_EQUALS,
         false,
         false,
         false);

    outRow = rf.makeEmptyRow();

    try
    {
      heapCC =
              tc.openConglomerate(
View Full Code Here

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

    ExecRow            baseRow;
    ExecIndexRow        indexableRow;
    int              numColumns;
    long            conglomId;
    RowLocation          rl;
    CatalogRowFactory      rf = ti.getCatalogRowFactory();
    IndexRowGenerator      irg;
    ConglomerateDescriptor  conglomerateDescriptor;

    initSystemIndexVariables(ddg, ti, indexNumber);

    irg = ti.getIndexRowGenerator(indexNumber);

    numColumns = ti.getIndexColumnCount(indexNumber);

    /* Is the index unique */
    isUnique = ti.isIndexUnique(indexNumber);

    // create an index row template
    indexableRow = irg.getIndexRowTemplate();

    baseRow = rf.makeEmptyRow();

    // Get a RowLocation template
    cc = tc.openConglomerate(
      heapConglomerateNumber, false, 0,
            TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ);

    rl = cc.newRowLocationTemplate();
    cc.close();

    // Get an index row based on the base row
    irg.getIndexRow(baseRow, rl, indexableRow, (FormatableBitSet) null);

    // Describe the properties of the index to the store using Properties
    // RESOLVE: The following properties assume a BTREE index.
    Properties  indexProperties = ti.getCreateIndexProperties(indexNumber);

    // Tell it the conglomerate id of the base table
    indexProperties.put(
      "baseConglomerateId",
      Long.toString( heapConglomerateNumber ) );

    // All indexes are unique because they contain the RowLocation.
    // The number of uniqueness columns must include the RowLocation
    // if the user did not specify a unique index.
    indexProperties.put("nUniqueColumns",
              Integer.toString(
                isUnique ? numColumns : numColumns + 1));

    // By convention, the row location column is the last column
    indexProperties.put("rowLocationColumn",
              Integer.toString(numColumns));

    // For now, all columns are key fields, including the RowLocation
    indexProperties.put("nKeyFields",
              Integer.toString(numColumns + 1));

    /* Create and add the conglomerate (index) */
    conglomId = tc.createConglomerate(
      "BTREE", // we're requesting an index conglomerate
      indexableRow.getRowArray(),
      null, //default sort order
            null, //default collation id's for collumns in all system congloms
      indexProperties, // default properties
      TransactionController.IS_DEFAULT); // not temporary

    conglomerateDescriptor =
      ddg.newConglomerateDescriptor(conglomId,
                      rf.getIndexName(indexNumber),
                      true,
                      irg,
                      false,
                      rf.getCanonicalIndexUUID(indexNumber),
                      rf.getCanonicalTableUUID(),
                      sd.getUUID());
    ti.setIndexConglomerate( conglomerateDescriptor );

    return conglomerateDescriptor;
  }
View Full Code Here

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

                       int indexNumber)
    throws StandardException
  {
    int          numCols = ti.getIndexColumnCount(indexNumber);
    int[]        baseColumnPositions = new int[numCols];
    CatalogRowFactory  rf = ti.getCatalogRowFactory();

    for (int colCtr = 0; colCtr < numCols; colCtr++)
    {
      baseColumnPositions[colCtr] =
        ti.getBaseColumnPosition(indexNumber, colCtr);
View Full Code Here

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

                              SchemaDescriptor sd,
                  TransactionController tc,
                  DataDescriptorGenerator ddg)
            throws StandardException
  {
    CatalogRowFactory  crf = ti.getCatalogRowFactory();

    String        name = ti.getTableName();
    long        conglomId = ti.getHeapConglomerate();
    SystemColumn[]    columnList = crf.buildColumnList();
    UUID        heapUUID = crf.getCanonicalHeapUUID();
    String        heapName = crf.getCanonicalHeapName();
    TableDescriptor    td;
    UUID        toid;
    ColumnDescriptor  cd;
    int          columnCount;
    SystemColumn    column;

    // add table to the data dictionary

    columnCount = columnList.length;
    td = ddg.newTableDescriptor(name, sd, TableDescriptor.SYSTEM_TABLE_TYPE,
                    TableDescriptor.ROW_LOCK_GRANULARITY);
    td.setUUID(crf.getCanonicalTableUUID());
    addDescriptor(td, sd, SYSTABLES_CATALOG_NUM,
            false, tc);
    toid = td.getUUID();
 
    /* Add the conglomerate for the heap */
 
View Full Code Here

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

            TupleDescriptor parentTupleDescriptor,
            List list,
            boolean forUpdate)
      throws StandardException
  {
    CatalogRowFactory    rf = ti.getCatalogRowFactory();
    ConglomerateController  heapCC;
    ExecIndexRow        indexRow1;
    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    RowLocation        baseRowLocation;
    ScanController      scanController;
    TransactionController  tc;
    TupleDescriptor      td = null;

    // Get the current transaction controller
    tc = getTransactionCompile();

    outRow = rf.makeEmptyRow();

    heapCC = tc.openConglomerate(
                ti.getHeapConglomerate(), false, 0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ);

    /* Scan the index and go to the data pages for qualifying rows to
     * build the column descriptor.
     */
    scanController = tc.openScan(
        ti.getIndexConglomerate(indexId)// conglomerate to open
        false, // don't hold open across commit
        (forUpdate) ? TransactionController.OPENMODE_FORUPDATE : 0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ,
        (FormatableBitSet) null,         // all fields as objects
        keyRow.getRowArray(),   // start position - first row
        ScanController.GE,      // startSearchOperation
        scanQualifiers,         //scanQualifier,
        keyRow.getRowArray(),   // stop position - through last row
        ScanController.GT);     // stopSearchOperation

    while (scanController.next())
    {
       // create an index row template
      indexRow1 = getIndexRowFromHeapRow(
                  ti.getIndexRowGenerator(indexId),
                  heapCC.newRowLocationTemplate(),
                  outRow);

      scanController.fetch(indexRow1.getRowArray());

      baseRowLocation = (RowLocationindexRow1.getColumn(
                        indexRow1.nColumns());

            // RESOLVE paulat - remove the try catch block when track 3677 is fixed
            // just leave the contents of the try block
            // adding to get more info on track 3677

            boolean base_row_exists = false;
            try
            {
          base_row_exists =
                    heapCC.fetch(
                        baseRowLocation, outRow.getRowArray(), (FormatableBitSet) null);
            }
            catch (RuntimeException re)
            {
                if (SanityManager.DEBUG)
                {
                    if (re instanceof AssertFailure)
                    {
              StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
              strbuf.append(": An ASSERT was thrown when trying to locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                        debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    }
                }
                throw re;
            }
            catch (StandardException se)
            {
                if (SanityManager.DEBUG)
                {
                    // only look for a specific error i.e. that of record on page
                    // no longer exists
                    // do not want to catch lock timeout errors here
                    if (se.getSQLState().equals("XSRS9"))
                    {
              StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
              strbuf.append(": A StandardException was thrown when trying to locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                        debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    }
                }
                throw se;
            }

            if (SanityManager.DEBUG)
            {
                // it can not be possible for heap row to disappear while
                // holding scan cursor on index at ISOLATION_REPEATABLE_READ.
        if (! base_row_exists)
        {
          StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
          strbuf.append(": could not locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                    debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    // RESOLVE: for now, we are going to kill the VM
                    // to help debug this problem.
                    System.exit(1);

                    // RESOLVE: not currently reached
                    //SanityManager.THROWASSERT(strbuf.toString());
        }
            }

      td = rf.buildDescriptor(outRow, parentTupleDescriptor, this);

      /* If list is null, then caller only wants a single descriptor - we're done
       * else just add the current descriptor to the list.
       */
      if (list == null)
View Full Code Here

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

                   TransactionController tc)
    throws StandardException
  {
    TabInfoImpl ti =  (catalogNumber < NUM_CORE) ? coreInfo[catalogNumber] :
      getNonCoreTI(catalogNumber);
    CatalogRowFactory crf = ti.getCatalogRowFactory();

    ExecRow[] rl = new ExecRow[td.length];

    for (int index = 0; index < td.length; index++)
    {
      ExecRow row = crf.makeRow(td[index], parent);
      rl[index] = row;
    }

    int insertRetCode = ti.insertRowList( rl, tc );
    if (!allowDuplicates && insertRetCode != TabInfoImpl.ROWNOTDUPLICATE)
View Full Code Here

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

    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    ScanController      scanController = null;
    boolean          foundRow;
    FormatableBitSet          colToCheck = new FormatableBitSet(indexCol);
    CatalogRowFactory    rf = ti.getCatalogRowFactory()

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(indexId >= 0, "code needs to be enhanced"+
        " to support a table scan to find the index id");
    }

    colToCheck.set(indexCol - 1);

    ScanQualifier[][] qualifier = exFactory.getScanQualifier(1);
    qualifier[0][0].setQualifier
        (indexCol - 1,
         schemaIdOrderable,
         Orderable.ORDER_OP_EQUALS,
         false,
         false,
         false);

    outRow = rf.makeEmptyRow();

    try
    {
      heapCC =
              tc.openConglomerate(
View Full Code Here

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

    ExecRow            baseRow;
    ExecIndexRow        indexableRow;
    int              numColumns;
    long            conglomId;
    RowLocation          rl;
    CatalogRowFactory      rf = ti.getCatalogRowFactory();
    IndexRowGenerator      irg;
    ConglomerateDescriptor  conglomerateDescriptor;

    initSystemIndexVariables(ddg, ti, indexNumber);

    irg = ti.getIndexRowGenerator(indexNumber);

    numColumns = ti.getIndexColumnCount(indexNumber);

    /* Is the index unique */
    isUnique = ti.isIndexUnique(indexNumber);

    // create an index row template
    indexableRow = irg.getIndexRowTemplate();

    baseRow = rf.makeEmptyRow();

    // Get a RowLocation template
    cc = tc.openConglomerate(
      heapConglomerateNumber, false, 0,
            TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ);

    rl = cc.newRowLocationTemplate();
    cc.close();

    // Get an index row based on the base row
    irg.getIndexRow(baseRow, rl, indexableRow, (FormatableBitSet) null);

    // Describe the properties of the index to the store using Properties
    // RESOLVE: The following properties assume a BTREE index.
    Properties  indexProperties = ti.getCreateIndexProperties(indexNumber);

    // Tell it the conglomerate id of the base table
    indexProperties.put(
      "baseConglomerateId",
      Long.toString( heapConglomerateNumber ) );

    // All indexes are unique because they contain the RowLocation.
    // The number of uniqueness columns must include the RowLocation
    // if the user did not specify a unique index.
    indexProperties.put("nUniqueColumns",
              Integer.toString(
                isUnique ? numColumns : numColumns + 1));

    // By convention, the row location column is the last column
    indexProperties.put("rowLocationColumn",
              Integer.toString(numColumns));

    // For now, all columns are key fields, including the RowLocation
    indexProperties.put("nKeyFields",
              Integer.toString(numColumns + 1));

    /* Create and add the conglomerate (index) */
    conglomId = tc.createConglomerate(
      "BTREE", // we're requesting an index conglomerate
      indexableRow.getRowArray(),
      null, //default sort order
            null, //default collation id's for collumns in all system congloms
      indexProperties, // default properties
      TransactionController.IS_DEFAULT); // not temporary

    conglomerateDescriptor =
      ddg.newConglomerateDescriptor(conglomId,
                      rf.getIndexName(indexNumber),
                      true,
                      irg,
                      false,
                      rf.getCanonicalIndexUUID(indexNumber),
                      rf.getCanonicalTableUUID(),
                      sd.getUUID());
    ti.setIndexConglomerate( conglomerateDescriptor );

    return conglomerateDescriptor;
  }
View Full Code Here

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

                       int indexNumber)
    throws StandardException
  {
    int          numCols = ti.getIndexColumnCount(indexNumber);
    int[]        baseColumnPositions = new int[numCols];
    CatalogRowFactory  rf = ti.getCatalogRowFactory();

    for (int colCtr = 0; colCtr < numCols; colCtr++)
    {
      baseColumnPositions[colCtr] =
        ti.getBaseColumnPosition(indexNumber, colCtr);
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.