@Override public String toString() { StringBuilder sb = new StringBuilder(); if (columns == null) { sb.append('[').append(columnCount).append(" columns]"); } else { for (ColumnDefinitions.Definition column : columns) { sb.append('[').append(column.getName()); sb.append(" (").append(column.getType()).append(")]"); } } if (pagingState != null) sb.append(" (to be continued)"); return sb.toString(); } }
final Definition columnDef = columnDefIter.next(); item.add(DSClientUtilities.assign(row, null, null, columnDef.getType().getName(), null, columnDef.getName(), null, null));
/** * Iterate and return. * * @param rSet * the r set * @return the list */ private List iterateAndReturn(ResultSet rSet) { Iterator<Row> rowIter = rSet.iterator(); List results = new ArrayList(); while (rowIter.hasNext()) { Row row = rowIter.next(); ColumnDefinitions columnDefs = row.getColumnDefinitions(); Iterator<Definition> columnDefIter = columnDefs.iterator(); Map rowData = new HashMap(); while (columnDefIter.hasNext()) { Definition columnDef = columnDefIter.next(); rowData.put(columnDef.getName(), DSClientUtilities.assign(row, null, null, columnDef.getType().getName(), null, columnDef.getName(), null, null)); } results.add(rowData); } return results; }
@Override public String toString() { final ToStringHelper toStringHelper = MoreObjects.toStringHelper(this); for (Definition definition : getRow().getColumnDefinitions().asList()) { toStringHelper.add(definition.getName(), toString(definition.getName(), definition.getType())); } String s = "[" + result.getExecutionInfo().getQueriedHost() + "] "+ toStringHelper.toString(); if (result.getExecutionInfo().getQueryTrace() != null) { StringBuilder sb = new StringBuilder("\n"); for (Event event : result.getExecutionInfo().getQueryTrace().getEvents()) { sb.append(event.getSource() + " - " + event.getSourceElapsedMicros() + ": " + event.getDescription() +"\n"); } s = s + sb.toString(); } return s; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (columns == null) { sb.append('[').append(columnCount).append(" columns]"); } else { for (ColumnDefinitions.Definition column : columns) { sb.append('[').append(column.getName()); sb.append(" (").append(column.getType()).append(")]"); } } if (pagingState != null) sb.append(" (to be continued)"); return sb.toString(); } }
for (ColumnDefinitions.Definition v : pst.getVariables()) { System.out.printf("%s %s%n", v.getName(), v.getType().getName()); }
@Override public Object getObject(Map<String, Definition> mapDefinition, FieldInformation field, Row row) { Definition column = mapDefinition.get(field.getName().toLowerCase()); ByteBuffer buffer = (ByteBuffer) RelationShipJavaCassandra.INSTANCE .getObject(row, column.getType().getName(), column.getName()); CustomData customData = field.getField().getAnnotation(CustomData.class); Customizable customizable = Customizable.class .cast(ReflectionUtil.INSTANCE.newInstance(customData .classCustmo())); return customizable.write(buffer); }
/** * Column family exists verify. * @param resultSet */ private void verifyRowType(ResultSet resultSet, Class<?> class1, Session session) { Map<String, String> mapNameType = new HashMap<String, String>(); for (Definition column : resultSet.getColumnDefinitions()) { mapNameType .put(column.getName(), column.getType().getName().name()); } ClassInformation classInformation = ClassInformations.INSTACE.getClass(class1); verifyRow(classInformation, session, mapNameType); }
public int getColumnType(int column) throws SQLException { DataType type = null; if(currentRow!=null){ type = currentRow.getColumnDefinitions().getType(column-1); }else{ type = driverResultSet.getColumnDefinitions().asList().get(column-1).getType(); } return TypesMap.getTypeForComparator(type.toString()).getJdbcType(); }
public String getColumnClassName(int column) throws SQLException { if(currentRow!=null){ return DataTypeEnum.fromCqlTypeName(currentRow.getColumnDefinitions().getType(column-1).getName()).asJavaClass().getCanonicalName(); } return DataTypeEnum.fromCqlTypeName(driverResultSet.getColumnDefinitions().asList().get(column-1).getType().getName()).asJavaClass().getCanonicalName(); }
protected void updateParameterMetaData(CassandraCqlStatement cql, boolean force) throws SQLException { if (force || !Objects.equal(this.cqlStmt.getCql(), cql.getCql())) { this.cqlStmt = cql; PreparedStatement preparedStmt = getInnerPreparedStatement(cql.getCql()); parameterMetaData.clear(); for (ColumnDefinitions.Definition def : preparedStmt.getVariables().asList()) { parameterMetaData.addParameterDefinition(new CassandraColumnDefinition( def.getKeyspace(), def.getTable(), def.getName(), def.getName(), def.getType().toString(), false, false)); } } }
protected CassandraResultSet(BaseCassandraStatement statement, CassandraCqlStatement parsedStmt, ResultSet rs) { super(statement, parsedStmt); if (rs != null) { for (Definition def : rs.getColumnDefinitions()) { CassandraColumnDefinition d = new CassandraColumnDefinition( def.getKeyspace(), def.getTable(), def.getName(), def .getType().getName().toString(), false); metadata.addColumnDefinition(d); } } _resultSet = rs; }
@Override public Object getObject(Map<String, Definition> mapDefinition, FieldInformation field, Row row) { Definition column = mapDefinition.get(field.getName().toLowerCase()); return RelationShipJavaCassandra.INSTANCE.getObject(row, column .getType().getName(), column.getName()); }
public CqlColumnImpl(C colName, Row row, int index) { this.columnName = colName; this.row = row; this.index = index; Definition colDefinition = row.getColumnDefinitions().asList().get(index); isBlob = colDefinition.getType() == DataType.blob(); }
public CqlColumnImpl(C colName, Row row, int index, Definition colDefinition) { this.columnName = colName; this.row = row; this.index = index; isBlob = colDefinition.getType() == DataType.blob(); }
public String getColumnClassName(int column) throws SQLException {/* checkIndex(column); return values.get(column - 1).getValueType().getType().getName();*/ if(currentRow!=null){ return currentRow.getColumnDefinitions().getType(column-1).getName().toString(); } return driverResultSet.getColumnDefinitions().asList().get(column-1).getType().getName().toString(); }
public int getColumnType(int column) throws SQLException { DataType type = null; if(currentRow!=null){ type = currentRow.getColumnDefinitions().getType(column-1); }else{ type = driverResultSet.getColumnDefinitions().asList().get(column-1).getType(); } return TypesMap.getTypeForComparator(type.toString()).getJdbcType(); }
@Override public String toString() { ToStringHelper toStringHelper = MoreObjects.toStringHelper(this); for (Definition definition : getRow().getColumnDefinitions().asList()) { toStringHelper.add(definition.getName(), toString(definition.getName(), definition.getType())); } return toStringHelper.toString(); }
final String columnName = columnDef.getName(); // column name DataType dataType = columnDef.getType(); // data type
valueStr = "NULL"; } else { DataType type = definition.getType(); CodecRegistry codecRegistry = cluster.getConfiguration().getCodecRegistry(); TypeCodec<Object> codec = codecRegistry.codecFor(type);