comparison src/main/java/nl/cwi/monetdb/jdbc/MonetSavepoint.java @ 296:c5efd6e661e5

Add "final" keyword to classes, method arguments and local variables where possible.` Improved error messages in MonetSavepoint. Removed two not needed updateNCharacterStream() methods from MonetResultSet.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 07 Aug 2019 21:12:22 +0200 (2019-08-07)
parents 003ae6d881db
children bb273e9c7e09
comparison
equal deleted inserted replaced
295:003ae6d881db 296:c5efd6e661e5
27 * wide, two concurrent transactions are guaranteed to not to have the same 27 * wide, two concurrent transactions are guaranteed to not to have the same
28 * save point identifiers. In this implementation the validity of save points 28 * save point identifiers. In this implementation the validity of save points
29 * is determined by the server, which makes this a light implementation. 29 * is determined by the server, which makes this a light implementation.
30 * 30 *
31 * @author Fabian Groffen 31 * @author Fabian Groffen
32 * @version 1.0 32 * @version 1.1
33 */ 33 */
34 public final class MonetSavepoint implements java.sql.Savepoint { 34 public final class MonetSavepoint implements java.sql.Savepoint {
35 /** The id of the last created Savepoint */ 35 /** The id of the last created Savepoint */
36 private static final AtomicInteger highestId = new AtomicInteger(0); 36 private static final AtomicInteger highestId = new AtomicInteger(0);
37 37
43 /** 43 /**
44 * Creates a named MonetSavepoint object 44 * Creates a named MonetSavepoint object
45 */ 45 */
46 public MonetSavepoint(final String name) throws IllegalArgumentException { 46 public MonetSavepoint(final String name) throws IllegalArgumentException {
47 if (name == null || name.isEmpty()) 47 if (name == null || name.isEmpty())
48 throw new IllegalArgumentException("missing savepoint name string"); 48 throw new IllegalArgumentException("Missing savepoint name");
49 49
50 this.id = getNextId(); 50 this.id = getNextId();
51 this.name = name; 51 this.name = name;
52 } 52 }
53 53
68 * @throws SQLException if this is a named savepoint 68 * @throws SQLException if this is a named savepoint
69 */ 69 */
70 @Override 70 @Override
71 public int getSavepointId() throws SQLException { 71 public int getSavepointId() throws SQLException {
72 if (name != null) 72 if (name != null)
73 throw new SQLException("Cannot getID for named savepoint", "3B000"); 73 throw new SQLException("Cannot get ID of named savepoint", "3B000");
74 74
75 return id; 75 return id;
76 } 76 }
77 77
78 /** 78 /**
83 * @throws SQLException if this is an un-named savepoint 83 * @throws SQLException if this is an un-named savepoint
84 */ 84 */
85 @Override 85 @Override
86 public String getSavepointName() throws SQLException { 86 public String getSavepointName() throws SQLException {
87 if (name == null) 87 if (name == null)
88 throw new SQLException("Unable to retrieve name of unnamed savepoint", "3B000"); 88 throw new SQLException("Cannot get name of un-named savepoint", "3B000");
89 89
90 return name; 90 return name;
91 } 91 }
92 92
93 //== end of methods from Savepoint interface 93 //== end of methods from Savepoint interface
109 * a prefix string and a sequence number. 109 * a prefix string and a sequence number.
110 * 110 *
111 * @return the unique savepoint name 111 * @return the unique savepoint name
112 */ 112 */
113 final String getName() { 113 final String getName() {
114 return "MonetDBSP" + id; 114 return "JDBCSP" + id;
115 } 115 }
116 116
117 117
118 /** 118 /**
119 * Returns the next id, which is larger than the last returned id. This 119 * Returns the next id, which is larger than the last returned id. This