當前位置: 首頁>>代碼示例>>Java>>正文


Java Rep類代碼示例

本文整理匯總了Java中net.hydromatic.avatica.ColumnMetaData.Rep的典型用法代碼示例。如果您正苦於以下問題:Java Rep類的具體用法?Java Rep怎麽用?Java Rep使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Rep類屬於net.hydromatic.avatica.ColumnMetaData包,在下文中一共展示了Rep類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTableTypes

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
public ResultSet getTableTypes() {
    List<ColumnMetaData> tableTypeMeta = new ArrayList<ColumnMetaData>();
    tableTypeMeta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), false));
    List<Object[]> data = new ArrayList<Object[]>();
    Object[] row = new Object[1];
    row[0] = "TABLE";
    data.add(row);

    AvaticaResultSet resultSet = null;
    try {
        resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, new KylinEnumerator<Object[]>(data), ColumnMetaData.struct(tableTypeMeta)), this.conn.getTimeZone());
        KylinConnectionImpl.TROJAN.execute(resultSet);
    } catch (SQLException e) {
        logger.error(e.getLocalizedMessage(), e);
    }

    return resultSet;
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:19,代碼來源:KylinMetaImpl.java

示例2: getMetadata

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
@Override
public KylinMetaImpl.MetaProject getMetadata(String project) throws ConnectionException {
    List<ColumnMetaData> meta = new ArrayList<ColumnMetaData>();
    for (int i = 0; i < 10; i++) {
        meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
    }

    List<KylinMetaImpl.MetaTable> tables = new ArrayList<KylinMetaImpl.MetaTable>();
    KylinMetaImpl.MetaTable table = new KylinMetaImpl.MetaTable("dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", new ArrayList<KylinMetaImpl.MetaColumn>());
    tables.add(table);

    List<KylinMetaImpl.MetaSchema> schemas = new ArrayList<KylinMetaImpl.MetaSchema>();
    schemas.add(new KylinMetaImpl.MetaSchema("dummy", "dummy", tables));
    List<KylinMetaImpl.MetaCatalog> catalogs = new ArrayList<KylinMetaImpl.MetaCatalog>();
    catalogs.add(new KylinMetaImpl.MetaCatalog("dummy", schemas));

    return new KylinMetaImpl.MetaProject(null, catalogs);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:19,代碼來源:DummyClient.java

示例3: getAvaticaType

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
/**
 * Gets AvaticaType carrying both JDBC {@code java.sql.Type.*} type code
 * and SQL type name for given RPC-level type (from batch schema).
 */
private static AvaticaType getAvaticaType( MajorType rpcDateType ) {
  final String sqlTypeName = Types.getSqlTypeName( rpcDateType );
  final int jdbcTypeId = Types.getJdbcTypeCode( rpcDateType );
  return ColumnMetaData.scalar( jdbcTypeId, sqlTypeName,
                                Rep.BOOLEAN /* dummy value, unused */ );
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:11,代碼來源:DrillColumnMetaDataList.java

示例4: genColumnMeta

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
/**
 * @param queryRes
 * @return
 */
private List<ColumnMetaData> genColumnMeta(SQLResponseStub queryRes) {
    List<ColumnMetaData> metas = new ArrayList<ColumnMetaData>();
    for (int i = 0; i < queryRes.getColumnMetas().size(); i++) {
        SQLResponseStub.ColumnMetaStub scm = queryRes.getColumnMetas().get(i);
        ScalarType type = ColumnMetaData.scalar(scm.getColumnType(), scm.getColumnTypeName(), Rep.of(SQLTypeMap.convert(scm.getColumnType())));

        ColumnMetaData meta = new ColumnMetaData(i, scm.isAutoIncrement(), scm.isCaseSensitive(), scm.isSearchable(), scm.isCurrency(), scm.getIsNullable(), scm.isSigned(), scm.getDisplaySize(), scm.getLabel(), scm.getName(), scm.getSchemaName(), scm.getPrecision(), scm.getScale(), scm.getTableName(), scm.getSchemaName(), type, scm.isReadOnly(), scm.isWritable(), scm.isWritable(), null);

        metas.add(meta);
    }

    return metas;
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:18,代碼來源:KylinClient.java

示例5: query

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
@Override
public DataSet<Object[]> query(AvaticaStatement statement, String sql) {
    List<Object[]> data = new ArrayList<Object[]>();
    Object[] row = new Object[] { "foo", "bar", "tool" };
    data.add(row);
    Enumerator<Object[]> enumerator = new KylinEnumerator<Object[]>(data);
    List<ColumnMetaData> meta = new ArrayList<ColumnMetaData>();
    meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
    meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
    meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));

    return new DataSet<Object[]>(meta, enumerator);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:14,代碼來源:DummyClient.java

示例6: getColumnList

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
@Override
public List<ColumnMetaData> getColumnList() {
	System.err.println("GetColList");
	int i = 1;
	return ImmutableList.of( new ColumnMetaData( //
				i, // ordinal
				false, // autoIncrement
				true, // caseSensitive
				false, // searchable
				false, // currency
				ResultSetMetaData.columnNoNulls, //nullability
				false, // signed
				10, // display size.
				"test1", // label
				"test2", // columnname
				"test3", // schemaname
				0, // precision
				0, // scale
				"test3.1", // tablename is null so sqlline doesn't try to retrieve primary keys.
				"test4", // catalogname
				Rep.LONG.ordinal(),  // sql type
				"test5", // typename
				true, // readonly
				false, // writable
				false, // definitely writable
				"none", // column class name
				ColumnMetaData.Rep.BOOLEAN // Dummy value for representation as it doesn't apply in drill's case.
				));
}
 
開發者ID:rmetzger,項目名稱:stratosphere-sql,代碼行數:30,代碼來源:StratospherePrepareResult.java

示例7: setParam

import net.hydromatic.avatica.ColumnMetaData.Rep; //導入依賴的package包/類
/**
 * @param preparedState
 * @param param
 * @throws SQLException
 */
private void setParam(PreparedStatement preparedState, int index, PrepareSqlRequest.StateParam param) throws SQLException {
    boolean isNull = (null == param.getValue());

    Class<?> clazz;
    try {
        clazz = Class.forName(param.getClassName());
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    }

    Rep rep = Rep.of(clazz);

    switch (rep) {
    case PRIMITIVE_CHAR:
    case CHARACTER:
    case STRING:
        preparedState.setString(index, isNull ? null : String.valueOf(param.getValue()));
        break;
    case PRIMITIVE_INT:
    case INTEGER:
        preparedState.setInt(index, isNull ? 0 : Integer.valueOf(param.getValue()));
        break;
    case PRIMITIVE_SHORT:
    case SHORT:
        preparedState.setShort(index, isNull ? 0 : Short.valueOf(param.getValue()));
        break;
    case PRIMITIVE_LONG:
    case LONG:
        preparedState.setLong(index, isNull ? 0 : Long.valueOf(param.getValue()));
        break;
    case PRIMITIVE_FLOAT:
    case FLOAT:
        preparedState.setFloat(index, isNull ? 0 : Float.valueOf(param.getValue()));
        break;
    case PRIMITIVE_DOUBLE:
    case DOUBLE:
        preparedState.setDouble(index, isNull ? 0 : Double.valueOf(param.getValue()));
        break;
    case PRIMITIVE_BOOLEAN:
    case BOOLEAN:
        preparedState.setBoolean(index, !isNull && Boolean.parseBoolean(param.getValue()));
        break;
    case PRIMITIVE_BYTE:
    case BYTE:
        preparedState.setByte(index, isNull ? 0 : Byte.valueOf(param.getValue()));
        break;
    case JAVA_UTIL_DATE:
    case JAVA_SQL_DATE:
        preparedState.setDate(index, isNull ? null : java.sql.Date.valueOf(param.getValue()));
        break;
    case JAVA_SQL_TIME:
        preparedState.setTime(index, isNull ? null : Time.valueOf(param.getValue()));
        break;
    case JAVA_SQL_TIMESTAMP:
        preparedState.setTimestamp(index, isNull ? null : Timestamp.valueOf(param.getValue()));
        break;
    default:
        preparedState.setObject(index, isNull ? null : param.getValue());
    }
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:66,代碼來源:QueryService.java


注:本文中的net.hydromatic.avatica.ColumnMetaData.Rep類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。