当前位置: 首页>>代码示例>>Java>>正文


Java ColumnType.BIGINT属性代码示例

本文整理汇总了Java中org.apache.metamodel.schema.ColumnType.BIGINT属性的典型用法代码示例。如果您正苦于以下问题:Java ColumnType.BIGINT属性的具体用法?Java ColumnType.BIGINT怎么用?Java ColumnType.BIGINT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.metamodel.schema.ColumnType的用法示例。


在下文中一共展示了ColumnType.BIGINT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getColumnTypeFromElasticSearchType

public static ColumnType getColumnTypeFromElasticSearchType(final String metaDataFieldType) {
    final ColumnType columnType;
    if (metaDataFieldType.startsWith("date")) {
        columnType = ColumnType.DATE;
    } else if (metaDataFieldType.equals("long")) {
        columnType = ColumnType.BIGINT;
    } else if (metaDataFieldType.equals("string")) {
        columnType = ColumnType.STRING;
    } else if (metaDataFieldType.equals("float")) {
        columnType = ColumnType.FLOAT;
    } else if (metaDataFieldType.equals("boolean")) {
        columnType = ColumnType.BOOLEAN;
    } else if (metaDataFieldType.equals("double")) {
        columnType = ColumnType.DOUBLE;
    } else {
        columnType = ColumnType.STRING;
    }
    return columnType;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:19,代码来源:ElasticSearchUtils.java

示例2: testGetTables

@Test
public void testGetTables() throws Exception {
    MutableTable table1 = new MutableTable("table1");
    MutableTable table2 = new MutableTable("table2");
    MutableColumn t1column1 = new MutableColumn("t1c1", ColumnType.BIGINT);
    MutableColumn t2column1 = new MutableColumn("t2c1", ColumnType.BIGINT);
    MutableColumn t2column2 = new MutableColumn("t2c2", ColumnType.BIGINT);
    table1.addColumn(t1column1);
    t1column1.setTable(table1);
    table2.addColumn(t2column1);
    t2column1.setTable(table2);
    table2.addColumn(t2column2);
    t2column2.setTable(table2);

    ArrayList<Table> tableList = new ArrayList<Table>();
    tableList.add(table1);

    ArrayList<Column> columnList = new ArrayList<Column>();
    columnList.add(t2column1);

    Table[] tables = MetaModelHelper.getTables(tableList, columnList);
    assertEquals(2, tables.length);
    assertTrue(Arrays.asList(tables).contains(table1));
    assertTrue(Arrays.asList(tables).contains(table2));
}
 
开发者ID:apache,项目名称:metamodel,代码行数:25,代码来源:MetaModelHelperTest.java

示例3: testGetTableColumns

@Test
public void testGetTableColumns() throws Exception {
    MutableTable table1 = new MutableTable("table1");
    MutableColumn column1 = new MutableColumn("c1", ColumnType.BIGINT);
    MutableColumn column2 = new MutableColumn("c2", ColumnType.BIGINT);
    MutableColumn column3 = new MutableColumn("c3", ColumnType.BIGINT);
    table1.addColumn(column1);
    column1.setTable(table1);
    table1.addColumn(column2);
    column2.setTable(table1);
    table1.addColumn(column3);
    column3.setTable(table1);

    ArrayList<Column> columnList = new ArrayList<Column>();

    Column[] columns = MetaModelHelper.getTableColumns(table1, columnList);
    assertEquals(0, columns.length);

    columnList.add(column1);
    columnList.add(column3);

    columns = MetaModelHelper.getTableColumns(table1, columnList);
    assertEquals(2, columns.length);
    assertSame(column1, columns[0]);
    assertSame(column3, columns[1]);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:26,代码来源:MetaModelHelperTest.java

示例4: rewriteColumnType

@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
    if (columnType == ColumnType.NUMBER || columnType == ColumnType.NUMERIC || columnType == ColumnType.DECIMAL) {
        // as one of the only relational databases out there, Oracle has a
        // NUMBER type. For this reason NUMBER would be replaced by the
        // super-type's logic, but we handle it specifically here.
        super.rewriteColumnTypeInternal("NUMBER", columnSize);
    }
    if (columnType == ColumnType.BOOLEAN || columnType == ColumnType.BIT) {
        // Oracle has no boolean type, but recommends NUMBER(3) or CHAR(1).
        // For consistency with most other databases who have either a
        // boolean or a bit, we use the number variant because it's return
        // values (0 or 1) can be converted the most easily back to a
        // boolean.
        return "NUMBER(3)";
    }
    if (columnType == ColumnType.DOUBLE) {
        return "BINARY_DOUBLE";
    }
    if (columnType == ColumnType.FLOAT) {
        return "BINARY_FLOAT";
    }
    if (columnType == ColumnType.BINARY || columnType == ColumnType.VARBINARY) {
        return "RAW";
    }

    // following conversions based on
    // http://docs.oracle.com/cd/B19306_01/gateways.102/b14270/apa.htm
    if (columnType == ColumnType.TINYINT) {
        return "NUMBER(3)";
    }
    if (columnType == ColumnType.SMALLINT) {
        return "NUMBER(5)";
    }
    if (columnType == ColumnType.INTEGER) {
        return "NUMBER(10)";
    }
    if (columnType == ColumnType.BIGINT) {
        return "NUMBER(19)";
    }

    // Oracle has no "time only" data type but 'date' also includes time
    if (columnType == ColumnType.TIME) {
        super.rewriteColumnType(ColumnType.DATE, columnSize);
    }
    return super.rewriteColumnType(columnType, columnSize);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:47,代码来源:OracleQueryRewriter.java

示例5: getColumnTypeFromMetaDataField

private static ColumnType getColumnTypeFromMetaDataField(DataType.Name metaDataName) {
    switch (metaDataName) {
    case BIGINT:
    case COUNTER:
        return ColumnType.BIGINT;
    case BLOB:
        return ColumnType.BLOB;
    case BOOLEAN:
        return ColumnType.BOOLEAN;
    case DECIMAL:
        return ColumnType.DECIMAL;
    case DOUBLE:
        return ColumnType.DOUBLE;
    case FLOAT:
        return ColumnType.FLOAT;
    case INT:
        return ColumnType.INTEGER;
    case TEXT:
        return ColumnType.STRING;
    case TIMESTAMP:
        return ColumnType.TIMESTAMP;
    case UUID:
        return ColumnType.UUID;
    case VARCHAR:
        return ColumnType.VARCHAR;
    case VARINT:
        return ColumnType.BIGINT;
    case LIST:
        return ColumnType.LIST;
    case MAP:
        return ColumnType.MAP;
    case CUSTOM:
        return ColumnType.OTHER;
    case INET:
        return ColumnType.INET;
    case SET:
        return ColumnType.SET;
    default:
        return ColumnType.STRING;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:41,代码来源:CassandraDataContext.java

示例6: getExpectedColumnType

@Override
public ColumnType getExpectedColumnType(ColumnType type) {
    return ColumnType.BIGINT;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:4,代码来源:CountAggregateFunction.java

示例7: getExampleSchema

/**
 * Creates an example schema with three tables and a view:
 * <ul>
 * <li>contributor[contributor_id,name,country] (TABLE)</li>
 * <li>project[project_id,name,lines_of_code,parent_project_id] (TABLE)</li>
 * <li>role[contributor_id,project_id,role_name] (TABLE)</li>
 * <li>project_contributor[contributor,project,role] (VIEW)</li>
 * </ul>
 * The example schema is good for testing purposes and possess various
 * features of the schema model:
 * <ul>
 * <li>Relations between tables: one-Contributor-to-many-Role's and
 * many-Role's-to-one-Project</li>
 * <li>Recursive relations: A project can have a parent project</li>
 * <li>Views: The ProjectContributor view</li>
 * </ul>
 */
public static Schema getExampleSchema() {
    MutableSchema schema = new MutableSchema("MetaModelSchema");

    MutableTable table1 = new MutableTable(TABLE_CONTRIBUTOR, TableType.TABLE, schema);
    Column column1 = new MutableColumn(COLUMN_CONTRIBUTOR_CONTRIBUTOR_ID, ColumnType.INTEGER, table1, 0, false)
            .setIndexed(true).setPrimaryKey(true);
    Column column2 = new MutableColumn(COLUMN_CONTRIBUTOR_NAME, ColumnType.VARCHAR, table1, 1, false);
    Column column3 = new MutableColumn(COLUMN_CONTRIBUTOR_COUNTRY, ColumnType.VARCHAR, table1, 2, true);
    table1.setColumns(column1, column2, column3);

    MutableTable table2 = new MutableTable(TABLE_PROJECT, TableType.TABLE, schema);
    Column column4 = new MutableColumn(COLUMN_PROJECT_PROJECT_ID, ColumnType.INTEGER, table2, 0, false)
            .setPrimaryKey(true);
    Column column5 = new MutableColumn(COLUMN_PROJECT_NAME, ColumnType.VARCHAR, table2, 1, false);
    Column column6 = new MutableColumn(COLUMN_PROJECT_LINES_OF_CODE, ColumnType.BIGINT, table2, 2, true);
    Column column7 = new MutableColumn(COLUMN_PROJECT_PARENT_PROJECT_ID, ColumnType.INTEGER, table2, 3, true);
    table2.setColumns(column4, column5, column6, column7);

    MutableTable table3 = new MutableTable(TABLE_ROLE, TableType.TABLE, schema);
    Column column8 = new MutableColumn(COLUMN_ROLE_CONTRIBUTOR_ID, ColumnType.INTEGER, table3, 0, false)
            .setPrimaryKey(true);
    Column column9 = new MutableColumn(COLUMN_ROLE_PROJECT_ID, ColumnType.INTEGER, table3, 1, false)
            .setPrimaryKey(true);
    Column column10 = new MutableColumn(COLUMN_ROLE_ROLE_NAME, ColumnType.VARCHAR, table3, 2, false);
    table3.setColumns(column8, column9, column10);

    MutableTable table4 = new MutableTable(TABLE_PROJECT_CONTRIBUTOR, TableType.VIEW, schema);
    Column column11 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_CONTRIBUTOR, ColumnType.VARCHAR, table4, 0,
            false);
    Column column12 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_PROJECT, ColumnType.VARCHAR, table4, 1, false);
    Column column13 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_ROLE, ColumnType.VARCHAR, table4, 2, false);
    ArrayList<Column> columnList = new ArrayList<Column>();
    columnList.add(column11);
    columnList.add(column12);
    columnList.add(column13);
    table4.setColumns(columnList);

    // one-Contributor-to-many-Role's
    MutableRelationship.createRelationship( column1 , column8 );

    // one-Project-to-many-Role's
    MutableRelationship.createRelationship(column4 , column9 );

    // view relation [contributor -> contributor_name]
    MutableRelationship.createRelationship(column2 , column11 );

    // view relation [project -> project_name]
    MutableRelationship.createRelationship(column5 , column12 );

    // view relation [role -> role_name]
    MutableRelationship.createRelationship( column10 ,  column13 );

    schema.setTables(table1, table2, table3, table4);
    return schema;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:72,代码来源:MetaModelTestCase.java


注:本文中的org.apache.metamodel.schema.ColumnType.BIGINT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。