vtgate.execute(getQuery(createTable));
vtgate.commit();
String insertSql =
"insert into vtocc_ints values(:tiny, :tinyu, :small, :smallu, :medium, :mediumu, :normal, :normalu, :big, :bigu, :year)";
Query insertQuery = new QueryBuilder(insertSql, testEnv.keyspace, "master")
.addBindVar(BindVariable.forInt("tiny", -128))
.addBindVar(BindVariable.forInt("tinyu", 255))
.addBindVar(BindVariable.forInt("small", -32768))
.addBindVar(BindVariable.forInt("smallu", 65535))
.addBindVar(BindVariable.forInt("medium", -8388608))
.addBindVar(BindVariable.forInt("mediumu", 16777215))
.addBindVar(BindVariable.forLong("normal", -2147483648L))
.addBindVar(BindVariable.forLong("normalu", 4294967295L))
.addBindVar(BindVariable.forLong("big", -9223372036854775808L))
.addBindVar(BindVariable.forULong("bigu", UnsignedLong.valueOf("18446744073709551615")))
.addBindVar(BindVariable.forShort("year", (short) 2012))
.addKeyRange(KeyRange.ALL)
.build();
vtgate.begin();
vtgate.execute(insertQuery);
vtgate.commit();
String selectSql = "select * from vtocc_ints where tiny = -128";
Query selectQuery =
new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyRange(KeyRange.ALL).build();
Cursor cursor = vtgate.execute(selectQuery);
Assert.assertEquals(1, cursor.getRowsAffected());
Row row = cursor.next();
Assert.assertTrue(row.getInt("tiny").equals(-128));