diff --git a/src/main/java/com/salesforce/phoenix/jdbc/PhoenixStatement.java b/src/main/java/com/salesforce/phoenix/jdbc/PhoenixStatement.java index 41203c0a..b9695f0b 100644 --- a/src/main/java/com/salesforce/phoenix/jdbc/PhoenixStatement.java +++ b/src/main/java/com/salesforce/phoenix/jdbc/PhoenixStatement.java @@ -158,7 +158,7 @@ public String toString() { private boolean isClosed = false; private ResultSetMetaData resultSetMetaData; private int maxRows; - + private List batchQueryList = new ArrayList(); public PhoenixStatement(PhoenixConnection connection) { this.connection = connection; @@ -875,7 +875,9 @@ public Format getFormatter(PDataType type) { @Override public void addBatch(String sql) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // Naive implementation + // Simple add queries to a new list of String + this.batchQueryList.add(sql); } @Override @@ -885,7 +887,7 @@ public void cancel() throws SQLException { @Override public void clearBatch() throws SQLException { - throw new SQLFeatureNotSupportedException(); + this.batchQueryList.clear(); } @Override @@ -981,7 +983,17 @@ public boolean execute(String sql, String[] columnNames) throws SQLException { @Override public int[] executeBatch() throws SQLException { - throw new SQLFeatureNotSupportedException(); + + int[] rets = new int[this.batchQueryList.size()]; + int i=0; + + for (String sql : this.batchQueryList) + { + execute(sql); + rets[i++] = Statement.SUCCESS_NO_INFO; + } + + return rets; } @Override