Skip to content

Commit a4a2578

Browse files
authored
Merge pull request #343 from BenCodez/fix/mariadb-default-reconciliation
Preserve declared numeric user columns during reconciliation
2 parents 68c1dd9 + 96167c3 commit a4a2578

4 files changed

Lines changed: 422 additions & 35 deletions

File tree

‎AdvancedCore/src/main/java/com/bencodez/advancedcore/core/user/storage/sql/JdbcSqlUserStorage.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,14 @@ private DataValue readValue(ResultSet result, int index, DataType type) throws S
302302

303303
private void bind(PreparedStatement statement, int index, DataValue value, SqlUserSchema.ColumnDefinition definition) throws SQLException {
304304
if (value == null) statement.setObject(index, null);
305-
else if (value.isString()) statement.setString(index, value.getString());
305+
else if (value.isString()) {
306+
// PostgreSQL's unknown parameter type lets the destination column
307+
// parse the stored representation. This supports both ordinary text
308+
// columns and deliberately retained numeric/boolean SQL columns whose
309+
// public AdvancedCore value contract remains STRING.
310+
if (dialect == Dialect.POSTGRESQL) statement.setObject(index, value.getString(), Types.OTHER);
311+
else statement.setString(index, value.getString());
312+
}
306313
else if (value.isInt()) {
307314
// PostgreSQL's unspecified parameter type is inferred from the target
308315
// column. This preserves writes to both current integer columns and

0 commit comments

Comments
 (0)