Skip to content
Permalink
Browse files

[misc] code cleaning

(cherry picked from commit 1daec80)
  • Loading branch information...
rusher committed Jan 23, 2019
1 parent 6615d6a commit 613fa7d0028711941589257bbdc876a94cb3ce86
Showing with 8,988 additions and 8,452 deletions.
  1. +295 −257 src/main/java/org/mariadb/jdbc/CallableParameterMetaData.java
  2. +335 −304 src/main/java/org/mariadb/jdbc/MariaDbBlob.java
  3. +4 −4 src/main/java/org/mariadb/jdbc/MariaDbClob.java
  4. +11 −32 src/main/java/org/mariadb/jdbc/MariaDbConnection.java
  5. +5 −9 src/main/java/org/mariadb/jdbc/MariaDbDataSource.java
  6. +163 −169 src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java
  7. +94 −91 src/main/java/org/mariadb/jdbc/MariaDbParameterMetaData.java
  8. +615 −528 src/main/java/org/mariadb/jdbc/MariaDbPoolDataSource.java
  9. +360 −355 src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java
  10. +30 −30 src/main/java/org/mariadb/jdbc/MariaDbSavepoint.java
  11. +23 −91 src/main/java/org/mariadb/jdbc/MariaDbStatement.java
  12. +8 −8 src/main/java/org/mariadb/jdbc/MariaXaConnection.java
  13. +233 −223 src/main/java/org/mariadb/jdbc/MariaXaResource.java
  14. +20 −19 src/main/java/org/mariadb/jdbc/MySQLDataSource.java
  15. +2 −7 src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java
  16. +386 −360 src/main/java/org/mariadb/jdbc/internal/com/read/dao/Results.java
  17. +8 −8 src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java
  18. +3 −3 src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java
  19. +2 −4 src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java
  20. +2 −4 src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java
  21. +72 −74 src/main/java/org/mariadb/jdbc/internal/com/send/parameters/ReaderParameter.java
  22. +34 −34 src/main/java/org/mariadb/jdbc/internal/com/send/parameters/ShortParameter.java
  23. +73 −74 src/main/java/org/mariadb/jdbc/internal/com/send/parameters/StreamParameter.java
  24. +88 −91 src/main/java/org/mariadb/jdbc/internal/com/send/parameters/TimeParameter.java
  25. +81 −83 src/main/java/org/mariadb/jdbc/internal/com/send/parameters/TimestampParameter.java
  26. +266 −260 src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
  27. +2 −4 src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersSlavesListener.java
  28. +1 −1 src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java
  29. +172 −143 src/main/java/org/mariadb/jdbc/internal/logging/ProtocolLoggingProxy.java
  30. +10 −7 src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java
  31. +1 −2 src/main/java/org/mariadb/jdbc/internal/protocol/AuroraProtocol.java
  32. +192 −184 src/main/java/org/mariadb/jdbc/internal/protocol/MastersSlavesProtocol.java
  33. +13 −7 src/main/java/org/mariadb/jdbc/internal/util/DefaultOptions.java
  34. +13 −14 src/main/java/org/mariadb/jdbc/internal/util/Utils.java
  35. +3 −9 src/test/java/org/mariadb/jdbc/BaseTest.java
  36. +266 −286 src/test/java/org/mariadb/jdbc/BigQueryTest.java
  37. +247 −15 src/test/java/org/mariadb/jdbc/ConnectionTest.java
  38. +230 −205 src/test/java/org/mariadb/jdbc/DatatypeCompatibilityTest.java
  39. +176 −177 src/test/java/org/mariadb/jdbc/DatatypeTest.java
  40. +640 −611 src/test/java/org/mariadb/jdbc/DateTest.java
  41. +80 −6 src/test/java/org/mariadb/jdbc/DriverTest.java
  42. +15 −15 src/test/java/org/mariadb/jdbc/ErrorMessageTest.java
  43. +59 −64 src/test/java/org/mariadb/jdbc/GiganticLoadDataInfileTest.java
  44. +2 −2 src/test/java/org/mariadb/jdbc/JdbcParserTest.java
  45. +456 −500 src/test/java/org/mariadb/jdbc/PreparedStatementTest.java
  46. +64 −27 src/test/java/org/mariadb/jdbc/SslTest.java
  47. +123 −7 src/test/java/org/mariadb/jdbc/StatementTest.java
  48. +1,433 −1,450 src/test/java/org/mariadb/jdbc/StoredProcedureTest.java
  49. +966 −965 src/test/java/org/mariadb/jdbc/UpdateResultSetMethodsTest.java
  50. +191 −207 src/test/java/org/mariadb/jdbc/failover/AuroraFailoverTest.java
  51. +72 −78 src/test/java/org/mariadb/jdbc/failover/LoadBalanceFailoverTest.java
  52. +157 −174 src/test/java/org/mariadb/jdbc/failover/SequentialFailoverTest.java
  53. +143 −126 src/test/java/org/mariadb/jdbc/internal/util/DefaultOptionsTest.java
  54. +48 −44 src/test/java/org/mariadb/jdbc/internal/util/buffer/BufferTest.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -132,7 +132,7 @@ public String getSubString(long pos, int length) throws SQLException {
}
}

public Reader getCharacterStream() throws SQLException {
public Reader getCharacterStream() {
return new StringReader(toString());
}

@@ -175,11 +175,11 @@ public InputStream getAsciiStream() throws SQLException {
return getBinaryStream();
}

public long position(String searchStr, long start) throws SQLException {
public long position(String searchStr, long start) {
return toString().indexOf(searchStr, (int) start - 1) + 1;
}

public long position(Clob searchStr, long start) throws SQLException {
public long position(Clob searchStr, long start) {
return position(searchStr.toString(), start);
}

@@ -281,7 +281,7 @@ public long length() {
}

@Override
public void truncate(final long truncateLen) throws SQLException {
public void truncate(final long truncateLen) {

//truncate the number of UTF-16 characters
//this can result in a bad UTF-8 string if string finish with a
@@ -814,19 +814,17 @@ public void close() throws SQLException {
* checks if the connection is closed.
*
* @return true if the connection is closed
* @throws SQLException if the connection cannot be closed.
*/
public boolean isClosed() throws SQLException {
public boolean isClosed() {
return protocol.isClosed();
}

/**
* returns the meta data about the database.
*
* @return meta data about the db.
* @throws SQLException if there is a problem creating the meta data.
*/
public DatabaseMetaData getMetaData() throws SQLException {
public DatabaseMetaData getMetaData() {
UrlParser urlParser = protocol.getUrlParser();
return new MariaDbDatabaseMetaData(
this,
@@ -1056,13 +1054,11 @@ public void reenableWarnings() {
*
* @return the <code>java.util.Map</code> object associated with this <code>Connection</code>
* object
* @throws SQLException if a database access error occurs or this method is
* called on a closed connection
* @see #setTypeMap
* @since 1.2
*/
public Map<String, Class<?>> getTypeMap() throws SQLException {
return null;
public Map<String, Class<?>> getTypeMap() {
return new HashMap<>();
}

/**
@@ -1088,14 +1084,12 @@ public void setTypeMap(final Map<String, Class<?>> map) throws SQLException {
*
* @return the holdability, one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
* <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
* @throws SQLException if a database access error occurs or this method is called on a closed
* connection
* @see #setHoldability
* @see DatabaseMetaData#getResultSetHoldability
* @see ResultSet
* @since 1.4
*/
public int getHoldability() throws SQLException {
public int getHoldability() {
return ResultSet.HOLD_CURSORS_OVER_COMMIT;
}

@@ -1108,15 +1102,12 @@ public int getHoldability() throws SQLException {
* @param holdability a <code>ResultSet</code> holdability constant; one of
* <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
* <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
* @throws SQLException if a database access occurs, this method is called on a
* closed connection, or the given parameter is not a
* <code>ResultSet</code> constant indicating holdability
* @see #getHoldability
* @see DatabaseMetaData#getResultSetHoldability
* @see ResultSet
*/
@Override
public void setHoldability(final int holdability) throws SQLException {
public void setHoldability(final int holdability) {
//not handled
}

@@ -1190,12 +1181,8 @@ public void releaseSavepoint(final Savepoint savepoint) throws SQLException {
* <code>Clob</code> interface may be used to add data to the <code>Clob</code>.
*
* @return An object that implements the <code>Clob</code> interface
* @throws SQLException if an object that implements the <code>Clob</code>
* interface can not be constructed, this method is called
* on a closed connection or a database access error
* occurs.
*/
public Clob createClob() throws SQLException {
public Clob createClob() {
return new MariaDbClob();
}

@@ -1205,12 +1192,8 @@ public Clob createClob() throws SQLException {
* of the <code>Blob</code> interface may be used to add data to the <code>Blob</code>.
*
* @return An object that implements the <code>Blob</code> interface
* @throws SQLException if an object that implements the <code>Blob</code>
* interface can not be constructed, this method is called
* on a closed connection or a database access error
* occurs.
*/
public Blob createBlob() throws SQLException {
public Blob createBlob() {
return new MariaDbBlob();
}

@@ -1221,12 +1204,8 @@ public Blob createBlob() throws SQLException {
* <code>NClob</code> interface may be used to add data to the <code>NClob</code>.
*
* @return An object that implements the <code>NClob</code> interface
* @throws SQLException if an object that implements the <code>NClob</code>
* interface can not be constructed, this method is called
* on a closed connection or a database access error
* occurs.
*/
public NClob createNClob() throws SQLException {
public NClob createNClob() {
return new MariaDbClob();
}

@@ -1708,12 +1687,12 @@ public int getNetworkTimeout() throws SQLException {
}
}

public String getSchema() throws SQLException {
public String getSchema() {
// We support only catalog
return null;
}

public void setSchema(String arg0) throws SQLException {
public void setSchema(String arg0) {
// We support only catalog, and JDBC indicate "If the driver does not support schemas, it will silently ignore this request."
}

@@ -333,10 +333,9 @@ public Connection getConnection(final String username, final String password)
* the default is for logging to be disabled.</p>
*
* @return the log writer for this data source or null if logging is disabled
* @throws SQLException if a database access error occurs
* @see #setLogWriter
*/
public PrintWriter getLogWriter() throws SQLException {
public PrintWriter getLogWriter() {
return null;
}

@@ -353,10 +352,9 @@ public PrintWriter getLogWriter() throws SQLException {
* the default is for logging to be disabled.</p>
*
* @param out the new log writer; to disable logging, set to null
* @throws SQLException if a database access error occurs
* @see #getLogWriter
*/
public void setLogWriter(final PrintWriter out) throws SQLException {
public void setLogWriter(final PrintWriter out) {
//not implemented
}

@@ -367,10 +365,9 @@ public void setLogWriter(final PrintWriter out) throws SQLException {
* created, the login timeout is initially zero.
*
* @return the data source login time limit
* @throws SQLException if a database access error occurs.
* @see #setLoginTimeout
*/
public int getLoginTimeout() throws SQLException {
public int getLoginTimeout() {
if (connectTimeoutInMs != null) {
return connectTimeoutInMs / 1000;
}
@@ -384,11 +381,10 @@ public int getLoginTimeout() throws SQLException {
* is created, the login timeout is initially zero.
*
* @param seconds the data source login time limit
* @throws SQLException if a database access error occurs.
* @see #getLoginTimeout
*/
@Override
public void setLoginTimeout(final int seconds) throws SQLException {
public void setLoginTimeout(final int seconds) {
connectTimeoutInMs = seconds * 1000;
}

@@ -479,7 +475,7 @@ public XAConnection getXAConnection(String user, String password) throws SQLExce
return new MariaXaConnection((MariaDbConnection) getConnection(user, password));
}

public Logger getParentLogger() throws SQLFeatureNotSupportedException {
public Logger getParentLogger() {
return null;
}

0 comments on commit 613fa7d

Please sign in to comment.
You can’t perform that action at this time.