use of nl.topicus.jdbc.CloudSpannerConnection in project spanner-jdbc by olavloite.
the class CloudSpannerStatementTest method testInsert.
@Test
public void testInsert() throws SQLException {
CloudSpannerConnection connection = createConnection();
CloudSpannerStatement statement = connection.createStatement();
boolean isResultSet = statement.execute(INSERT_SQL);
Assert.assertFalse(isResultSet);
int count = statement.getUpdateCount();
Assert.assertEquals(1, count);
boolean moreResults = statement.getMoreResults();
Assert.assertFalse(moreResults);
Assert.assertEquals(-1, statement.getUpdateCount());
int count2 = statement.executeUpdate(INSERT_SQL);
Assert.assertEquals(1, count2);
}
use of nl.topicus.jdbc.CloudSpannerConnection in project spanner-jdbc by olavloite.
the class AbstractTablePartWorkerTest method createWorker.
private AbstractTablePartWorker createWorker(String sql, ParameterStore parameters) throws JSQLParserException {
CloudSpannerConnection connection = mock(CloudSpannerConnection.class);
Select select = (Select) CCJSqlParserUtil.parse(sql);
DMLOperation operation = DMLOperation.INSERT;
AbstractTablePartWorker worker = mock(AbstractTablePartWorker.class, withSettings().useConstructor(connection, select, parameters, true, operation).defaultAnswer(CALLS_REAL_METHODS));
return worker;
}
Aggregations