Binding a whole number so SQLite stores and compares it as an INTEGER.
ctx.storage.sql.exec() binds every JavaScript number as a REAL and refuses a BigInt, so a PHP
0 arrives as 0.0. Against an INTEGER column that is invisible, because the column converts
it back. Against a TEXT column it is not: varchar_col = 0.0 compares as '0.0' and matches
nothing, and an INSERT stores '0.0'. PostgreSQL and MySQL coerce an integer against a varchar,
and PDO's SQLite driver binds a PHP int as an INTEGER, so a module that keeps an enum ordinal in
a string field (mantle2's field_visibility) works on both and listed nothing here.
+CAST(? AS INTEGER) is the form that fixes both directions. The cast makes the value an
INTEGER and the unary + strips the cast's affinity, so a TEXT column still has its own
affinity applied to the value ('0') and its index is still usable.
Binding a whole number so SQLite stores and compares it as an INTEGER.
ctx.storage.sql.exec()binds every JavaScript number as a REAL and refuses a BigInt, so a PHP0arrives as0.0. Against an INTEGER column that is invisible, because the column converts it back. Against a TEXT column it is not:varchar_col = 0.0compares as'0.0'and matches nothing, and an INSERT stores'0.0'. PostgreSQL and MySQL coerce an integer against a varchar, and PDO's SQLite driver binds a PHP int as an INTEGER, so a module that keeps an enum ordinal in a string field (mantle2'sfield_visibility) works on both and listed nothing here.+CAST(? AS INTEGER)is the form that fixes both directions. The cast makes the value an INTEGER and the unary+strips the cast's affinity, so a TEXT column still has its own affinity applied to the value ('0') and its index is still usable.