11package com .dbschema ;
22
3- import com .datastax .driver .core .BatchStatement ;
4- import com .datastax .driver .core .Session ;
5- import com .datastax .driver .core .exceptions .SyntaxError ;
3+ import com .couchbase .client .java .Cluster ;
4+ import com .couchbase .client .java .query .QueryResult ;
65
7- import java .sql .*;
6+ import java .sql .Connection ;
7+ import java .sql .ResultSet ;
8+ import java .sql .SQLException ;
9+ import java .sql .SQLFeatureNotSupportedException ;
10+ import java .sql .SQLWarning ;
11+ import java .sql .Statement ;
812
913/**
1014 * @author Liudmila Kornilova
1115 **/
12- public abstract class CassandraBaseStatement implements Statement {
13- final com .datastax .driver .core .Session session ;
14- BatchStatement batchStatement = null ;
16+ public abstract class CouchbaseBaseStatement implements Statement {
17+ final Cluster cluster ;
1518 private boolean isClosed = false ;
16- CassandraResultSet result ;
19+ CouchbaseResultSet result ;
1720
18- CassandraBaseStatement ( Session session ) {
19- this .session = session ;
21+ CouchbaseBaseStatement ( Cluster cluster ) {
22+ this .cluster = cluster ;
2023 }
2124
2225 @ Override
@@ -35,16 +38,10 @@ public boolean isClosed() {
3538 return isClosed ;
3639 }
3740
38- boolean executeInner (com . datastax . driver . core . ResultSet resultSet , boolean returnNullStrings ) throws SQLException {
41+ boolean executeInner (QueryResult resultSet , boolean returnNullStrings ) throws SQLException {
3942 try {
40- result = new CassandraResultSet (this , resultSet , returnNullStrings );
41- if (!result .isQuery ()) {
42- result = null ;
43- return false ;
44- }
43+ result = new CouchbaseResultSet (this , resultSet , returnNullStrings );
4544 return true ;
46- } catch (SyntaxError ex ) {
47- throw new SQLSyntaxErrorException (ex .getMessage (), ex );
4845 } catch (Throwable t ) {
4946 throw new SQLException (t .getMessage (), t );
5047 }
@@ -64,20 +61,7 @@ public int getUpdateCount() throws SQLException {
6461
6562 @ Override
6663 public int [] executeBatch () throws SQLException {
67- if (batchStatement == null ) throw new SQLException ("No batch statements were submitted" );
68- int statementsCount = batchStatement .size ();
69- try {
70- session .execute (batchStatement );
71- } catch (Throwable t ) {
72- throw new SQLException (t .getMessage (), t );
73- } finally {
74- batchStatement = null ;
75- }
76- int [] res = new int [statementsCount ];
77- for (int i = 0 ; i < statementsCount ; i ++) {
78- res [i ] = SUCCESS_NO_INFO ;
79- }
80- return res ;
64+ throw new SQLFeatureNotSupportedException ();
8165 }
8266
8367 @ Override
@@ -152,7 +136,7 @@ public void setQueryTimeout(int seconds) throws SQLException {
152136
153137 @ Override
154138 public void cancel () throws SQLException {
155- throw new SQLFeatureNotSupportedException ("Cassandra provides no support for interrupting an operation." );
139+ throw new SQLFeatureNotSupportedException ("Couchbase provides no support for interrupting an operation." );
156140 }
157141
158142 @ Override
0 commit comments