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


Java DataType.ascii方法代碼示例

本文整理匯總了Java中com.datastax.driver.core.DataType.ascii方法的典型用法代碼示例。如果您正苦於以下問題:Java DataType.ascii方法的具體用法?Java DataType.ascii怎麽用?Java DataType.ascii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.datastax.driver.core.DataType的用法示例。


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

示例1: currentRowField

import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
/** Get a field for the current row from the underlying object.
 *
 * @param index Index of the field within the Row object
 * @param typeName Type of the field in this row
 */
private Object currentRowField(int index, SqlTypeName typeName) {
  DataType type = current.getColumnDefinitions().getType(index);
  if (type == DataType.ascii() || type == DataType.text() || type == DataType.varchar()) {
    return current.getString(index);
  } else if (type == DataType.cint() || type == DataType.varint()) {
    return current.getInt(index);
  } else if (type == DataType.bigint()) {
    return current.getLong(index);
  } else if (type == DataType.cdouble()) {
    return current.getDouble(index);
  } else if (type == DataType.cfloat()) {
    return current.getFloat(index);
  } else if (type == DataType.uuid() || type == DataType.timeuuid()) {
    return current.getUUID(index).toString();
  } else {
    return null;
  }
}
 
開發者ID:apache,項目名稱:calcite,代碼行數:24,代碼來源:CassandraEnumerator.java

示例2: getDataType

import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
private DataType getDataType() {
    int i = random.nextInt(3);

    switch (i) {
        case 0: return DataType.ascii();
        case 1: return DataType.bigint();
    }
    return null;
}
 
開發者ID:arnaudroger,項目名稱:SimpleFlatMapper,代碼行數:10,代碼來源:DatastaxMapperKeyComparatorTest.java

示例3: getRelDataType

import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
RelProtoDataType getRelDataType(String columnFamily, boolean view) {
  List<ColumnMetadata> columns;
  if (view) {
    columns = getKeyspace().getMaterializedView(columnFamily).getColumns();
  } else {
    columns = getKeyspace().getTable(columnFamily).getColumns();
  }

  // Temporary type factory, just for the duration of this method. Allowable
  // because we're creating a proto-type, not a type; before being used, the
  // proto-type will be copied into a real type factory.
  final RelDataTypeFactory typeFactory =
      new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
  final RelDataTypeFactory.Builder fieldInfo = typeFactory.builder();
  for (ColumnMetadata column : columns) {
    final String columnName = column.getName();
    final DataType type = column.getType();

    // TODO: This mapping of types can be done much better
    SqlTypeName typeName = SqlTypeName.ANY;
    if (type == DataType.uuid() || type == DataType.timeuuid()) {
      // We currently rely on this in CassandraFilter to detect UUID columns.
      // That is, these fixed length literals should be unquoted in CQL.
      typeName = SqlTypeName.CHAR;
    } else if (type == DataType.ascii() || type == DataType.text()
          || type == DataType.varchar()) {
      typeName = SqlTypeName.VARCHAR;
    } else if (type == DataType.cint() || type == DataType.varint()) {
      typeName = SqlTypeName.INTEGER;
    } else if (type == DataType.bigint()) {
      typeName = SqlTypeName.BIGINT;
    } else if (type == DataType.cdouble() || type == DataType.cfloat()
        || type == DataType.decimal()) {
      typeName = SqlTypeName.DOUBLE;
    }

    fieldInfo.add(columnName, typeFactory.createSqlType(typeName)).nullable(true);
  }

  return RelDataTypeImpl.proto(fieldInfo.build());
}
 
開發者ID:apache,項目名稱:calcite,代碼行數:42,代碼來源:CassandraSchema.java


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