22
22
23
23
import java .net .URI ;
24
24
import java .sql .Connection ;
25
+ import java .sql .PreparedStatement ;
25
26
import java .sql .ResultSet ;
26
27
import java .sql .Statement ;
27
28
@@ -168,9 +169,25 @@ public final class ErrorConstants {
168
169
"Index must be a positive number less or equal the count of returned columns: %d" ;
169
170
170
171
/**
171
- * Error message used in any SQL exception thrown when the specified column name in a {@link ResultSet}
172
- * is invalid. This message is a template expecting the value of the invalid column name as placeholder (example:
173
- * {@code String.format(VALID_LABELS, "invalid_column")}).
172
+ * Error message used in any SQL exception thrown when the specified index for a variable binding in a
173
+ * {@link PreparedStatement} is greater than the number of binding variable markers in the CQL query. This message
174
+ * is a template expecting the value of the invalid index and the number of markers as placeholders (example:
175
+ * {@code String.format(OUT_OF_BOUNDS_BINDING_INDEX, 5, 3)}).
176
+ */
177
+ public static final String OUT_OF_BOUNDS_BINDING_INDEX =
178
+ "The index %d is greater than the count of bound variable markers in the CQL: %d" ;
179
+
180
+ /**
181
+ * Error message used in any SQL exception thrown when the specified index for a variable binding in a
182
+ * {@link PreparedStatement} is not strictly positive. This message is a template expecting the value of the
183
+ * invalid index value as placeholder (example: {@code String.format(MUST_BE_POSITIVE_BINDING_INDEX, 0)}).
184
+ */
185
+ public static final String MUST_BE_POSITIVE_BINDING_INDEX = "The binding index must be a positive number: %d" ;
186
+
187
+ /**
188
+ * Error message used in any exception thrown when the specified column name in a {@link ResultSet} or a row
189
+ * definition is invalid. This message is a template expecting the value of the invalid column name as placeholder
190
+ * (example: {@code String.format(VALID_LABELS, "invalid_column")}).
174
191
*/
175
192
public static final String VALID_LABELS = "Name provided was not in the list of valid column labels: %s" ;
176
193
@@ -275,6 +292,13 @@ public final class ErrorConstants {
275
292
public static final String UNSUPPORTED_JSON_TYPE_CONVERSION =
276
293
"Unable to convert the column of index %d to an instance of %s" ;
277
294
295
+ /**
296
+ * Error message used in any SQL exception thrown when the conversion to JSON for the specified object in the method
297
+ * {@link CassandraPreparedStatement#setJson(int, Object)} is not supported.
298
+ */
299
+ public static final String UNSUPPORTED_CONVERSION_TO_JSON =
300
+ "Unable to convert the object of type %s to bind the column of index %d" ;
301
+
278
302
/**
279
303
* Error message used in any SQL exception thrown when it is not possible to retrieve some metadata of any
280
304
* {@link ResultSet}.
@@ -297,6 +321,27 @@ public final class ErrorConstants {
297
321
public static final String TOO_MANY_QUERIES =
298
322
"Too many queries at once (%d). You must split your queries into more batches!" ;
299
323
324
+ /**
325
+ * Error message used in any SQL exception thrown when the fetch direction specified on a ResultSet is not
326
+ * supported for the type {@code TYPE_FORWARD_ONLY}. This message is a template expecting the illegal fetch
327
+ * direction as placeholder (example:
328
+ * {@code String.format(ILLEGAL_FETCH_DIRECTION_FOR_FORWARD_ONLY, FETCH_UNKNOWN)}).
329
+ */
330
+ public static final String ILLEGAL_FETCH_DIRECTION_FOR_FORWARD_ONLY =
331
+ "Attempt to set an illegal fetch direction for TYPE_FORWARD_ONLY: %d" ;
332
+
333
+ /**
334
+ * Error message used in any SQL exception thrown when retrieving metadata related to a catalog and the given one
335
+ * is not {@code null} or does not match the one of the current connection.
336
+ */
337
+ public static final String INVALID_CATALOG_NAME = "Catalog name must exactly match or be null." ;
338
+
339
+ /**
340
+ * Error message used in any SQL exception thrown when the creation of the connection to the database fails for
341
+ * any reason. The underlying exception should be logged in this case.
342
+ */
343
+ public static final String CONNECTION_CREATION_FAILED = "Unexpected error while creating connection." ;
344
+
300
345
private ErrorConstants () {
301
346
// Private constructor to hide the public one.
302
347
}
0 commit comments