Account for NULL types in queries

Also fixed a variable that may have been creating redundant connections
This commit is contained in:
Salmonllama 2020-07-30 18:03:23 -04:00
parent d8905f6914
commit 90527ad370

View File

@ -28,7 +28,8 @@ public class DatabaseProvider {
SQLiteConnectionPoolDataSource dataSource = new SQLiteConnectionPoolDataSource();
dataSource.setDatabaseName(DB_NAME);
dataSource.setUrl(DB_ADDR);
return dataSource.getConnection();
c = dataSource.getConnection();
return c;
} catch (SQLException e) {
e.printStackTrace();
System.out.println("Could not connect to database, double check config values");
@ -58,6 +59,8 @@ public class DatabaseProvider {
}
else if (p instanceof Timestamp) {
query.setTimestamp(index, (Timestamp) p);
} else if (p == null) {
query.setNull(index, Types.NULL);
} else {
throw new UnknownParameterException(p, index);
}