示例#1
0
 /**
  * Get the list of columns as a string.
  *
  * @return the list of columns
  */
 private String getColumnListSQL() {
   StatementBuilder buff = new StatementBuilder();
   for (IndexColumn c : indexColumns) {
     buff.appendExceptFirst(", ");
     buff.append(c.getSQL());
   }
   return buff.toString();
 }
示例#2
0
 private void createIndex() {
   IndexColumn[] indexCols = null;
   if (sort != null) {
     int[] colIndex = sort.getQueryColumnIndexes();
     indexCols = new IndexColumn[colIndex.length];
     for (int i = 0; i < colIndex.length; i++) {
       IndexColumn indexColumn = new IndexColumn();
       indexColumn.column = table.getColumn(colIndex[i]);
       indexColumn.sortType = sort.getSortTypes()[i];
       indexColumn.columnName = COLUMN_NAME + i;
       indexCols[i] = indexColumn;
     }
   } else {
     indexCols = new IndexColumn[columnCount];
     for (int i = 0; i < columnCount; i++) {
       IndexColumn indexColumn = new IndexColumn();
       indexColumn.column = table.getColumn(i);
       indexColumn.columnName = COLUMN_NAME + i;
       indexCols[i] = indexColumn;
     }
   }
   String indexName = table.getSchema().getUniqueIndexName(session, table, Constants.PREFIX_INDEX);
   int indexId = session.getDatabase().allocateObjectId();
   IndexType indexType = IndexType.createNonUnique(true);
   index = table.addIndex(session, indexName, indexId, indexCols, indexType, true, null);
 }
示例#3
0
 public MVDelegateIndex(
     MVTable table, int id, String name, MVPrimaryIndex mainIndex, IndexType indexType) {
   IndexColumn[] cols =
       IndexColumn.wrap(new Column[] {table.getColumn(mainIndex.getMainIndexColumn())});
   this.initBaseIndex(table, id, name, cols, indexType);
   this.mainIndex = mainIndex;
   if (id < 0) {
     throw DbException.throwInternalError("" + name);
   }
 }
示例#4
0
 public PageDelegateIndex(
     TableData table,
     int id,
     String name,
     IndexType indexType,
     PageDataIndex mainIndex,
     int headPos,
     Session session)
     throws SQLException {
   IndexColumn[] columns =
       IndexColumn.wrap(new Column[] {table.getColumn(mainIndex.getMainIndexColumn())});
   this.initBaseIndex(table, id, name, columns, indexType);
   this.mainIndex = mainIndex;
   if (!database.isPersistent() || id < 0) {
     throw Message.throwInternalError("" + name);
   }
   PageStore store = database.getPageStore();
   store.addIndex(this);
   if (headPos == Index.EMPTY_HEAD) {
     store.addMeta(this, session);
   }
 }
 /**
  * @param ctx Context.
  * @param tbl Table.
  * @param name Index name.
  */
 public GridMergeIndexUnsorted(GridKernalContext ctx, GridMergeTable tbl, String name) {
   super(ctx, tbl, name, IndexType.createScan(false), IndexColumn.wrap(tbl.getColumns()));
 }