avoid boolean outside of sqlite

This commit is contained in:
Charlie Kolb 2025-10-17 12:33:49 +02:00
parent 2a2dd9660e
commit 2fe58635d9
No known key found for this signature in database

View File

@ -402,18 +402,18 @@ export function resolvePath(
// difference we don't care for in the face of imminent removal of support
const path = toSQLitePath(pathArray);
const base = `json_extract(${ref}, '${path.replaceAll("'", "\\'")}')`;
// if (typeof value === 'number') {
// return `CAST(${base} as ${dataTableColumnTypeToSql('number', dbType)})`;
// }
// if (value instanceof Date) {
// return `CAST(${base} as ${dataTableColumnTypeToSql('date', dbType)})`;
// }
// if (typeof value === 'boolean') {
// return `CAST(${base} as ${dataTableColumnTypeToSql('boolean', dbType)})`;
// }
// if (typeof value === 'string') {
// return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`;
// }
if (typeof value === 'number') {
return `CAST(${base} as ${dataTableColumnTypeToSql('number', dbType)})`;
}
if (value instanceof Date) {
return `CAST(${base} as ${dataTableColumnTypeToSql('date', dbType)})`;
}
if (typeof value === 'boolean') {
return `CAST(${base} as ${dbType.startsWith('sqlite') ? dataTableColumnTypeToSql('boolean', dbType) : 'INTEGER'})`;
}
if (typeof value === 'string') {
return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`;
}
// return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`;
return base;
}