Skip to content

Commit 4535551

Browse files
committed
Add support for COPY TO special CQL command
1 parent 155be2f commit 4535551

12 files changed

+614
-49
lines changed

Diff for: CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

77
## [Unreleased]
88
### Added
9-
- Add support for the special CQL command `SOURCE <filename>` in `CassandraStatement`.
9+
- Add support for the following special CQL commands in `CassandraStatement`:
10+
- `SOURCE <filename>`
11+
- `COPY <tableName>[(<colums>)] TO <target>[ WITH <options>[ AND <options>...]]`
1012
- Add a method `CassandraConnection.setOptionSet(OptionSet)` to programmatically define a custom compliance mode option
1113
set on a pre-existing connection.
1214

Diff for: NOTICE.txt

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Copyright 2009 Google
5353
This product includes software developed as part of the JSR305 Annotations for Findbugs project
5454
( https://code.google.com/archive/p/jsr-305/ ).
5555

56+
OpenCSV
57+
Copyright 2005 Bytecode Pty Ltd.
58+
This product includes software developed as part of the OpenCSV project
59+
( https://opencsv.sourceforge.net/ ).
60+
5661
Semver4j
5762
Copyright 2022-present Semver4j contributors
5863
This product includes software developed as part of the Semver4j project

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Connect to a Cassandra cluster using the following arguments:
120120
* JDBC driver class: `com.ing.data.cassandra.jdbc.CassandraDriver`
121121
* JDBC URL: `jdbc:cassandra://host1--host2--host3:9042/keyspace?localdatacenter=DC1`
122122

123-
You can give the driver any number of hosts you want separated by "--". You can optionally specify a port for each host.
123+
You can give the driver any number of hosts you want separated by `--`. You can optionally specify a port for each host.
124124
If only one port is specified after all the listed hosts, it applies to all hosts. If no port is specified at all, the
125125
default Cassandra port (9042) is used.
126126
They will be used as contact points for the driver to discover the entire cluster.

Diff for: pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<java.driver.version>4.18.1</java.driver.version>
131131
<jackson.version>2.18.2</jackson.version>
132132
<javax-jsr305.version>3.0.2</javax-jsr305.version>
133+
<opencsv.version>5.9</opencsv.version>
133134
<semver4j.version>5.4.1</semver4j.version>
134135
<!-- Versions for test dependencies -->
135136
<approvaltests.version>24.12.0</approvaltests.version>
@@ -254,6 +255,13 @@
254255
<version>${aws-secretsmanager.version}</version>
255256
</dependency>
256257

258+
<!-- OpenCSV for implementation of COPY special command -->
259+
<dependency>
260+
<groupId>com.opencsv</groupId>
261+
<artifactId>opencsv</artifactId>
262+
<version>${opencsv.version}</version>
263+
</dependency>
264+
257265
<!-- Unit tests libraries -->
258266
<dependency>
259267
<groupId>org.mockito</groupId>

Diff for: src/main/java/com/ing/data/cassandra/jdbc/CassandraStatement.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public ResultSet executeQuery(final String cql) throws SQLException {
537537
*
538538
* @param cql A CQL Data Manipulation Language (DML) statement, such as {@code INSERT}, {@code UPDATE}, or
539539
* {@code DELETE}; or a CQL statement that returns nothing, such as a DDL statement.
540-
* @return Always 0, for any statement. The rationale is that Datastax Java driver does not provide update count.
540+
* @return Always 0, for any statement. The rationale is that DataStax Java driver does not provide update count.
541541
* @throws SQLException when something went wrong during the execution of the statement.
542542
*/
543543
@Override

Diff for: src/main/java/com/ing/data/cassandra/jdbc/commands/ConsistencyLevelExecutor.java

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
* connection to the given value, otherwise return a result set with a single row containing the
4141
* current consistency level in a column {@code consistency_level}.
4242
* </p>
43+
* <p>
44+
* The documentation of the original {@code CONSISTENCY} command is available:
45+
* <ul>
46+
* <li><a href="https://cassandra.apache.org/doc/latest/cassandra/managing/tools/cqlsh.html#consistency">
47+
* in the Apache Cassandra® documentation</a></li>
48+
* <li><a href="https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlshConsistency.html">
49+
* in the DataStax CQL reference documentation</a></li>
50+
* </ul>
51+
* </p>
4352
*/
4453
public class ConsistencyLevelExecutor implements SpecialCommandExecutor {
4554

0 commit comments

Comments
 (0)