|
|
|
|
|
by masklinn
1761 days ago
|
|
> A strictly typed database would error out here, a dynamically typed one will just assign the int to the string column, potentially corrupting data. I would assume posgres is considered "strictly typed", yet it will never error on the correct version of this: all parameters are necessarily passed as `char*` equivalent to "normal" untyped literals/strings. The best you can do is provide an explicit type (via `paramTypes`), which skips inference and is equivalent to typed constants[0]. [0] https://www.postgresql.org/docs/current/sql-syntax-lexical.h... |
|
I have no idea how the postgres C API looks, but the SQLite API has different functions for binding different kinds of data types to prepared statements, like `sqlite3_bind_int` for ints, `sqlite3_bind_blob` for binary blobs, `sqlite3_bind_text` for strings, and so forth. So SQLite "knows" the source type you're binding.