use of com.palantir.nexus.db.sql.AgnosticResultSet in project atlasdb by palantir.
the class TableValueStyleCacheTest method setup.
@Before
public void setup() {
SqlConnection mockConnection = mock(SqlConnection.class);
when(connectionSupplier.get()).thenReturn(mockConnection);
AgnosticResultSet resultSet = mock(AgnosticResultSet.class);
when(mockConnection.selectResultSetUnregisteredQuery(startsWith("SELECT table_size FROM"), anyObject())).thenReturn(resultSet);
AgnosticResultRow row = mock(AgnosticResultRow.class);
when(row.getInteger(eq("table_size"))).thenReturn(TableValueStyle.OVERFLOW.getId());
doReturn(ImmutableList.of(row)).when(resultSet).rows();
when(mockConnection.getUnderlyingConnection()).thenReturn(mock(Connection.class));
}
use of com.palantir.nexus.db.sql.AgnosticResultSet in project atlasdb by palantir.
the class DbKvsGetRanges method getRowsForBatches.
private static SortedSetMultimap<Integer, byte[]> getRowsForBatches(Supplier<SqlConnection> connectionSupplier, String query, Object[] args) {
SqlConnection connection = connectionSupplier.get();
try {
AgnosticResultSet results = connection.selectResultSetUnregisteredQuery(query, args);
SortedSetMultimap<Integer, byte[]> ret = TreeMultimap.create(Ordering.natural(), UnsignedBytes.lexicographicalComparator());
for (AgnosticResultRow row : results.rows()) {
@SuppressWarnings("deprecation") byte[] rowName = row.getBytes("row_name");
int batchNum = row.getInteger("batch_num");
if (rowName != null) {
ret.put(batchNum, rowName);
}
}
return ret;
} finally {
closeSql(connection);
}
}
use of com.palantir.nexus.db.sql.AgnosticResultSet in project atlasdb by palantir.
the class OracleDdlTable method checkDatabaseVersion.
@Override
public void checkDatabaseVersion() {
AgnosticResultSet result = conns.get().selectResultSetUnregisteredQuery("SELECT version FROM product_component_version where lower(product) like '%oracle%'");
String version = result.get(0).getString("version");
if (VersionStrings.compareVersions(version, MIN_ORACLE_VERSION) < 0) {
log.error("Your key value service currently uses version {}" + " of oracle. The minimum supported version is {}" + ". If you absolutely need to use an older version of oracle," + " please contact Palantir support for assistance.", version, MIN_ORACLE_VERSION);
}
}
use of com.palantir.nexus.db.sql.AgnosticResultSet in project atlasdb by palantir.
the class PostgresDdlTable method checkDatabaseVersion.
@Override
public void checkDatabaseVersion() {
AgnosticResultSet result = conns.get().selectResultSetUnregisteredQuery("SHOW server_version");
String version = result.get(0).getString("server_version");
PostgresVersionCheck.checkDatabaseVersion(version, log);
}
Aggregations