本文整理汇总了Java中com.datastax.driver.core.ColumnDefinitions.Definition方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnDefinitions.Definition方法的具体用法?Java ColumnDefinitions.Definition怎么用?Java ColumnDefinitions.Definition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.datastax.driver.core.ColumnDefinitions
的用法示例。
在下文中一共展示了ColumnDefinitions.Definition方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SchemaStatement
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
PreparedStatement statement, Integer thriftId, ConsistencyLevel cl, ValidationType validationType)
{
super(timer, settings, spec);
this.statement = statement;
this.thriftId = thriftId;
this.cl = cl;
this.validationType = validationType;
argumentIndex = new int[statement.getVariables().size()];
bindBuffer = new Object[argumentIndex.length];
int i = 0;
for (ColumnDefinitions.Definition definition : statement.getVariables())
argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());
statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
示例2: SchemaStatement
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
PreparedStatement statement, Integer thriftId, ConsistencyLevel cl)
{
super(timer, settings, spec);
this.statement = statement;
this.thriftId = thriftId;
this.cl = cl;
argumentIndex = new int[statement.getVariables().size()];
bindBuffer = new Object[argumentIndex.length];
definitions = statement.getVariables();
int i = 0;
for (ColumnDefinitions.Definition definition : definitions)
argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());
statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
示例3: createOutputRowMeta
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
void createOutputRowMeta(RowMetaInterface row, ResultSet rs) {
row.clear();
for (ColumnDefinitions.Definition d : rs.getColumnDefinitions()) {
logDebug(d.getName() + ',' + d.getType().getName() + ',' + d.getType().asFunctionParameterString());
ValueMetaBase valueMeta = new ValueMetaBase(d.getName(), Utils.convertDataType(d.getType()));
valueMeta.setTrimType(0);
row.addValueMeta(valueMeta);
}
}
示例4: findRow
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
* Find row.
*
* @param pk the pk
* @return the map
* @throws Exception the exception
*/
public Map<String,Object> findRow( String pk ) throws Exception {
try {
Map<String,Object> map = null;
String select = String.format("SELECT * FROM actuator_state where login_source_sensor='%s'", pk);
logger.debug("select={}",select);
long before = System.currentTimeMillis();
ResultSet rs = execute(select);
Iterator<Row> it = rs.iterator();
Row row = rs.one();
if( row != null ) {
map = new HashMap<String,Object>();
logger.info(">>> elapsed {}",(System.currentTimeMillis()-before));
ColumnDefinitions columnDefinitions = row.getColumnDefinitions();
for( ColumnDefinitions.Definition columnDefinition : columnDefinitions) {
String name = columnDefinition.getName();
Object value = row.getObject(name);
map.put( name, value );
}
}
return map;
} catch( Exception e ) {
logger.error(e.getLocalizedMessage(), e);
throw e;
}
}
示例5: executeQuery
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public QueryResult executeQuery(String sql)
throws QueryExecutionException
{
ensureConnected();
ResultSet rs = session.execute(sql);
List<ColumnDefinitions.Definition> definitions = rs.getColumnDefinitions().asList();
List<JDBCType> types = definitions.stream()
.map(definition -> getJDBCType(definition.getType()))
.collect(toList());
List<String> columnNames = definitions.stream()
.map(ColumnDefinitions.Definition::getName)
.collect(toList());
QueryResult.QueryResultBuilder resultBuilder = new QueryResult.QueryResultBuilder(types, columnNames);
for (Row row : rs) {
List<Object> builderRow = newArrayList();
for (int i = 0; i < types.size(); ++i) {
builderRow.add(row.getToken(i).getValue());
}
resultBuilder.addRow(builderRow);
}
return resultBuilder.build();
}
示例6: asList
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
protected List<Object> asList(Row row) {
if (row == null)
return null;
List<ColumnDefinitions.Definition> columns = row.getColumnDefinitions().asList();
List<Object> list = Lists.newArrayListWithCapacity(columns.size());
for (ColumnDefinitions.Definition column : columns)
list.add(getObject(row, column.getName(), column.getType()));
return list;
}
示例7: asMap
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
* row as map.
*/
protected Map<String, Object> asMap(Row row) {
if (row == null)
return null;
List<ColumnDefinitions.Definition> columns = row.getColumnDefinitions().asList();
Map<String, Object> map = Maps.newHashMapWithExpectedSize(columns.size());
for (ColumnDefinitions.Definition column : columns) {
String name = column.getName();
map.put(name, getObject(row, name, column.getType()));
}
return map;
}
示例8: SchemaStatement
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, PartitionGenerator generator, StressSettings settings, Distribution partitionCount,
PreparedStatement statement, Integer thriftId, ConsistencyLevel cl, ValidationType validationType)
{
super(timer, generator, settings, partitionCount);
this.generator = generator;
this.statement = statement;
this.thriftId = thriftId;
this.cl = cl;
this.validationType = validationType;
argumentIndex = new int[statement.getVariables().size()];
bindBuffer = new Object[argumentIndex.length];
int i = 0;
for (ColumnDefinitions.Definition definition : statement.getVariables())
argumentIndex[i++] = generator.indexOf(definition.getName());
}
示例9: transform
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
* Extract name of columndefinions
* @param definition Definition Objetc
* @return name of definition
*/
@Override
public String transform(ColumnDefinitions.Definition definition) {
String name = definition.getName();
if (name==null)
name="";
return name;
}
示例10: mockResultSet
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ResultSet mockResultSet(List<Row> rows,ColumnDefinitions columDefiniton){
ResultSet resultSet = mock(ResultSet.class);
ColumnDefinitions.Definition mockDefinition = new DoubleDefinition().buildDefinitionWithName("");
expect(resultSet.getColumnDefinitions()).andStubReturn(columDefiniton);
expect(resultSet.all()).andStubReturn(rows);
replay(resultSet);
return resultSet;
}
示例11: mockColumnDefinions
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ColumnDefinitions mockColumnDefinions(){
ColumnDefinitions columnDefinions = mock(ColumnDefinitions.class);
List<ColumnDefinitions.Definition> columnDefinitions = new ArrayList<>();
columnDefinitions.add(new DoubleDefinition().buildDefinitionWithName(""));
expect(columnDefinions.asList()).andStubReturn(columnDefinitions);
replay(columnDefinions);
return columnDefinions;
}
示例12: mockColumnDefinionsWithoutData
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ColumnDefinitions mockColumnDefinionsWithoutData(){
ColumnDefinitions columnDefinions = mock(ColumnDefinitions.class);
List<ColumnDefinitions.Definition> columnDefinitions = new ArrayList<>();
expect(columnDefinions.asList()).andStubReturn(columnDefinitions);
replay(columnDefinions);
return columnDefinions;
}
示例13: buildDefinitionWithName
import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public ColumnDefinitions.Definition buildDefinitionWithName(String nameHeader) {
ColumnDefinitions.Definition definition = mock(ColumnDefinitions.Definition.class);
return definition;
}