public ColumnDefinitionsAssert doesNotContainVariable(String name) { assertThat(actual.getIndexOf(name)).isEqualTo(-1); return this; } }
private static boolean isNullOrAbsent(Row row, String name) { return row.getColumnDefinitions().getIndexOf(name) < 0 || row.isNull(name); }
@Override public void onSuccess(ResultSet result) { semaphore.release(); // Expect the column that you queried to be present, if its not we got the wrong // response // back. int columnIndex = result.getColumnDefinitions().getIndexOf(column); if (columnIndex == -1) { logger.error( "Got response without column {}, got columns {} from Host {}.", column, result.getColumnDefinitions(), result.getExecutionInfo().getQueriedHost()); errorTrigger.countDown(); return; } completed.incrementAndGet(); // Block netty io thread 25% of the time. int num = random.nextInt(1); if (num == 0) { // Sleep exactly one second, should trigger retry. Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } }
private int getColumnIndex(String columnName) { int index = columns.getIndexOf(columnName); Assert.isTrue(index > -1, String.format("Column [%s] does not exist in table", columnName)); return index; }
@Override protected int getIndexOf(String name) { return _oldRow.getColumnDefinitions().getIndexOf(name); }
@Override protected int getIndexOf(String name) { return _oldRow.getColumnDefinitions().getIndexOf(name); }
public ColumnDefinitionsAssert doesNotContainVariable(String name) { assertThat(actual.getIndexOf(name)).isEqualTo(-1); return this; } }
private static boolean isNullOrAbsent(Row row, String name) { return row.getColumnDefinitions().getIndexOf(name) < 0 || row.isNull(name); }
private static boolean isNullOrAbsent(Row row, String name) { return row.getColumnDefinitions().getIndexOf(name) < 0 || row.isNull(name); }
private static boolean isNullOrAbsent(Row row, String name) { return row.getColumnDefinitions().getIndexOf(name) < 0 || row.isNull(name); }
public int findColumn(String name) throws SQLException { checkNotClosed(); checkName(name); return currentRow.getColumnDefinitions().getIndexOf(name); }
@Override protected T wrapResultSet(ResultSet resultSet) { Row row = resultSet.one(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("got {} row for {} modify {}", row != null ? "1" : "no", mode, entity.type); } if (tracer != null) { tracer.onModifyWrapResultSet(persistenceSession, entity, mode, resultSet); } if (row != null) { int idx = row.getColumnDefinitions().getIndexOf("[applied]"); if (idx != -1 && !row.getBool(idx)) { throw new CasNotAppliedException(entity, instance, mode, row); } } persistenceSession.modified(binder, mode, entity, instance); Interceptors postModify = mode == PersistMode.DELETE ? entity.postDelete : entity.postPersist; if (postModify != null) { postModify.invoke(instance, entity, mode); } return null; }
@Override public void onSuccess(ResultSet result) { semaphore.release(); // Expect the column that you queried to be present, if its not we got the wrong // response // back. int columnIndex = result.getColumnDefinitions().getIndexOf(column); if (columnIndex == -1) { logger.error( "Got response without column {}, got columns {} from Host {}.", column, result.getColumnDefinitions(), result.getExecutionInfo().getQueriedHost()); errorTrigger.countDown(); return; } completed.incrementAndGet(); // Block netty io thread 25% of the time. int num = random.nextInt(1); if (num == 0) { // Sleep exactly one second, should trigger retry. Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } }
@Override public ParameterMetadata buildParameterMetadata(String nativeQuery) { PreparedStatement preparedStatement = session.prepare( nativeQuery ); ColumnDefinitions columnDefinitions = preparedStatement.getVariables(); OrdinalParameterDescriptor[] ordinalDescriptors = new OrdinalParameterDescriptor[columnDefinitions.size()]; if ( columnDefinitions.size() > 0 ) { // the cassandra metadata will give us the CQL type, but the type conversion system only goes // in hibernate->cassandra direction, so we can't turn it back into the required hibernate type. // instead we rely on the cached hibernate metadata from schema creation time String tableName = columnDefinitions.getTable( 0 ); Table table = metaDataCache.get( tableName ); for ( ColumnDefinitions.Definition definition : columnDefinitions ) { String name = definition.getName(); Column column = table.getColumn( Identifier.toIdentifier( name ) ); Type hibernateType = column.getValue().getType(); // cassandra side index is 0-based, hibernate side index is 1-based int index = columnDefinitions.getIndexOf( name ); ordinalDescriptors[index] = new OrdinalParameterDescriptor( index + 1, hibernateType, 0 ); } } return new ParameterMetadata( ordinalDescriptors, null ); } }