Aditya Naidu
Aditya Naidu

Reputation: 1380

Binding Values To Prepared Statements without knowing their data type

I have a sqlite3 prepared statement. I know the number of values to bind to this prepared statement, but don't know their data types. (I just get a CSV file with the right values). Is there a generic bind method I can use for this? All the bind method in the documentation are for a specific data type.

I know that sqlite3 uses a dynamic type system. But it doesn't help if you are using the C API due to the absence of a generic bind method.

Any ideas/tricks anyone has tried?

Upvotes: 0

Views: 333

Answers (1)

Neil
Neil

Reputation: 55392

The C API does not have a generic bind method because the C language does not have a generic type. Simply use the bind method for the type that you have, if it is wrong then sqlite will convert it for you.

Upvotes: 1

Related Questions