mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
Apply lint
This commit is contained in:
@@ -127,7 +127,8 @@ public final class JDBC4PreparedStatement extends JDBC4Statement implements Prep
|
||||
this.statement.bindNull(parameterIndex);
|
||||
} else {
|
||||
long time = x.getTime();
|
||||
this.statement.bindBlob(parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
this.statement.bindBlob(
|
||||
parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +139,8 @@ public final class JDBC4PreparedStatement extends JDBC4Statement implements Prep
|
||||
this.statement.bindNull(parameterIndex);
|
||||
} else {
|
||||
long time = x.getTime();
|
||||
this.statement.bindBlob(parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
this.statement.bindBlob(
|
||||
parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +151,8 @@ public final class JDBC4PreparedStatement extends JDBC4Statement implements Prep
|
||||
this.statement.bindNull(parameterIndex);
|
||||
} else {
|
||||
long time = x.getTime();
|
||||
this.statement.bindBlob(parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
this.statement.bindBlob(
|
||||
parameterIndex, ByteBuffer.allocate(Long.BYTES).putLong(time).array());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,16 +153,17 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
return wrapTypeConversion(() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Date(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
return wrapTypeConversion(
|
||||
() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Date(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -172,16 +173,17 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
return wrapTypeConversion(() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Time(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
return wrapTypeConversion(
|
||||
() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Time(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,16 +193,17 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
return wrapTypeConversion(() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Timestamp(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Timestamp: " + result.getClass());
|
||||
});
|
||||
return wrapTypeConversion(
|
||||
() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Timestamp(time);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Timestamp: " + result.getClass());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,20 +287,21 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
return wrapTypeConversion(() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Date(time);
|
||||
}
|
||||
}
|
||||
// Try to parse as string if it's stored as TEXT
|
||||
if (result instanceof String) {
|
||||
return Date.valueOf((String) result);
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
return wrapTypeConversion(
|
||||
() -> {
|
||||
if (result instanceof byte[]) {
|
||||
byte[] bytes = (byte[]) result;
|
||||
if (bytes.length == Long.BYTES) {
|
||||
long time = ByteBuffer.wrap(bytes).getLong();
|
||||
return new Date(time);
|
||||
}
|
||||
}
|
||||
// Try to parse as string if it's stored as TEXT
|
||||
if (result instanceof String) {
|
||||
return Date.valueOf((String) result);
|
||||
}
|
||||
throw new SQLException("Cannot convert value to Date: " + result.getClass());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -233,11 +233,11 @@ class JDBC4PreparedStatementTest {
|
||||
connection.prepareStatement("CREATE TABLE test (col BLOB)").execute();
|
||||
PreparedStatement stmt =
|
||||
connection.prepareStatement("INSERT INTO test (col) VALUES (?), (?), (?)");
|
||||
|
||||
Date date1 = new Date(1000000000000L);
|
||||
|
||||
Date date1 = new Date(1000000000000L);
|
||||
Date date2 = new Date(1500000000000L);
|
||||
Date date3 = new Date(2000000000000L);
|
||||
|
||||
Date date3 = new Date(2000000000000L);
|
||||
|
||||
stmt.setDate(1, date1);
|
||||
stmt.setDate(2, date2);
|
||||
stmt.setDate(3, date3);
|
||||
@@ -259,11 +259,11 @@ class JDBC4PreparedStatementTest {
|
||||
connection.prepareStatement("CREATE TABLE test (col BLOB)").execute();
|
||||
PreparedStatement stmt =
|
||||
connection.prepareStatement("INSERT INTO test (col) VALUES (?), (?), (?)");
|
||||
|
||||
Time time1 = new Time(1000000000000L);
|
||||
|
||||
Time time1 = new Time(1000000000000L);
|
||||
Time time2 = new Time(1500000000000L);
|
||||
Time time3 = new Time(2000000000000L);
|
||||
|
||||
Time time3 = new Time(2000000000000L);
|
||||
|
||||
stmt.setTime(1, time1);
|
||||
stmt.setTime(2, time2);
|
||||
stmt.setTime(3, time3);
|
||||
@@ -271,7 +271,7 @@ class JDBC4PreparedStatementTest {
|
||||
|
||||
PreparedStatement stmt2 = connection.prepareStatement("SELECT * FROM test;");
|
||||
JDBC4ResultSet rs = (JDBC4ResultSet) stmt2.executeQuery();
|
||||
|
||||
|
||||
assertTrue(rs.next());
|
||||
assertEquals(time1, rs.getTime(1));
|
||||
assertTrue(rs.next());
|
||||
@@ -285,11 +285,11 @@ class JDBC4PreparedStatementTest {
|
||||
connection.prepareStatement("CREATE TABLE test (col BLOB)").execute();
|
||||
PreparedStatement stmt =
|
||||
connection.prepareStatement("INSERT INTO test (col) VALUES (?), (?), (?)");
|
||||
|
||||
Timestamp timestamp1 = new Timestamp(1000000000000L);
|
||||
|
||||
Timestamp timestamp1 = new Timestamp(1000000000000L);
|
||||
Timestamp timestamp2 = new Timestamp(1500000000000L);
|
||||
Timestamp timestamp3 = new Timestamp(2000000000000L);
|
||||
|
||||
Timestamp timestamp3 = new Timestamp(2000000000000L);
|
||||
|
||||
stmt.setTimestamp(1, timestamp1);
|
||||
stmt.setTimestamp(2, timestamp2);
|
||||
stmt.setTimestamp(3, timestamp3);
|
||||
@@ -297,7 +297,7 @@ class JDBC4PreparedStatementTest {
|
||||
|
||||
PreparedStatement stmt2 = connection.prepareStatement("SELECT * FROM test;");
|
||||
JDBC4ResultSet rs = (JDBC4ResultSet) stmt2.executeQuery();
|
||||
|
||||
|
||||
assertTrue(rs.next());
|
||||
assertEquals(timestamp1, rs.getTimestamp(1));
|
||||
assertTrue(rs.next());
|
||||
|
||||
Reference in New Issue
Block a user