Package org.apache.metamodel.schema

Examples of org.apache.metamodel.schema.Column


        if (table == null && tableNames.length == 1) {
            table = schema.getTables()[0];
        }

        if (table != null) {
            Column column = table.getColumnByName(columnPath);
            if (column != null) {
                return column;
            }
        }
View Full Code Here


            for (int i = 0; i < offset; i++) {
                sequence.next();
            }

            for (int j = offset; j < row.getLastCellNum(); j++) {
                Column column = new MutableColumn(sequence.next(), ColumnType.STRING, table, j, true);
                table.addColumn(column);
            }
        } else {

            boolean hasColumns = true;
View Full Code Here

            Cell cell = row.getCell(j);
            String columnName = ExcelUtils.getCellValue(wb, cell);
            if (columnName == null || "".equals(columnName)) {
                columnName = "[Column " + (j + 1) + "]";
            }
            Column column = new MutableColumn(columnName, ColumnType.VARCHAR, table, j, true);
            table.addColumn(column);
        }
    }
View Full Code Here

  /**
   * Gets the size (in bytes) of a single {@link SelectItem}
   */
  protected int getValueSize(SelectItem selectItem) {
    Column column = selectItem.getColumn();
    if (column == null) {
      return DEFAULT_COLUMN_SIZE;
    } else {
      return getValueSize(column);
    }
View Full Code Here

        };
    }

    @Override
    public FilterBuilder<RowDeletionBuilder> where(String columnName) {
        Column column = getTable().getColumnByName(columnName);
        return where(column);
    }
View Full Code Here

                // check for lookup query by primary key
                if (whereItems.size() == 1) {
                    final FilterItem whereItem = whereItems.get(0);
                    final SelectItem selectItem = whereItem.getSelectItem();
                    if (!whereItem.isCompoundFilter() && selectItem != null && selectItem.getColumn() != null) {
                        final Column column = selectItem.getColumn();
                        if (column.isPrimaryKey() && whereItem.getOperator() == OperatorType.EQUALS_TO) {
                            logger.debug("Query is a primary key lookup query. Trying executePrimaryKeyLookupQuery(...)");
                            if (table != null) {
                                if (isMainSchemaTable(table)) {
                                    final Object operand = whereItem.getOperand();
                                    final Row row = executePrimaryKeyLookupQuery(table, selectItems, column, operand);
View Full Code Here

                        selectItemsToMaterialize.add(selectItem.replaceFunction(null));
                    }
                } else {
                    // the select item does not specify a specific
                    // from-item
                    final Column selectedColumn = selectItem.getColumn();
                    if (selectedColumn != null) {
                        // we assume that if the table matches, we will use the
                        // column
                        if (selectedColumn.getTable() != null && selectedColumn.getTable().equals(table)) {
                            selectItemsToMaterialize.add(selectItem.replaceFunction(null));
                        }
                    }
                }
            }
View Full Code Here

                Column[] primaryColumns = r.getPrimaryColumns();
                Column[] foreignColumns = r.getForeignColumns();
                Table pTable = r.getPrimaryTable();
                Table fTable = r.getForeignTable();
                for (int i = 0; i < primaryColumns.length; i++) {
                    Column pColumn = primaryColumns[i];
                    Column fColumn = foreignColumns[i];
                    data.add(new DefaultRow(header, new Object[] { pTable.getName(), pColumn.getName(),
                            fTable.getName(), fColumn.getName() }));
                }
            }
        } else {
            throw new IllegalArgumentException("Cannot materialize non information_schema table: " + table);
        }
View Full Code Here

        assertTrue(file.exists());

        ExcelDataContext dc = new ExcelDataContext(file);
        final Table table = dc.getDefaultSchema().getTables()[0];
        final Column nameColumn = table.getColumnByName("name");
        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
                Style clownStyle = new StyleBuilder().bold().foreground(255, 0, 0).background(0, 0, 255).create();
View Full Code Here

    public void testExecuteQueryBeforeLoadingSchema() throws Exception {
        // first use one DataContext to retreive the schema/table/column objects
        ExcelDataContext dc1 = new ExcelDataContext(new File("src/test/resources/Spreadsheet2007.xlsx"));
        Schema schema = dc1.getDefaultSchema();
        Table table = schema.getTable(0);
        Column column = table.getColumn(0);

        // query another DataContext using the schemas of the one above
        ExcelDataContext dc2 = new ExcelDataContext(new File("src/test/resources/Spreadsheet2007.xlsx"));
        DataSet ds = dc2.executeQuery(new Query().from(table).select(column));
View Full Code Here

TOP

Related Classes of org.apache.metamodel.schema.Column

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.