I'm trying to write a function with a sig like this:

int BindParameter(sqlite3_stmt* stmt, int sqlType, const char* pname, char* value);

Somewhere before the call(s) to BindParameter, I'll have a string that looks like this: (FOO=some text value, BAR=3.141, ZIP=45, TIMESTAMP1=01/17/12 17:54:00, TIMESTAMP2=542312453423)

My parameter values will always be input from a char string (as above), but the data types in the table are INTEGER, TEXT, REAL and NUMERIC. I was thinking that there must already be some easy way of getting to the correct bind call. In the end, I would like to have something like this inside the BindParameter function:

case INTEGER:
sqlite3_bind_int(stmt, sqlite3_bind_parameter_index(stmt, pname), data);

case REAL:
sqlite3_bind_double(stmt, sqlite3_bind_parameter_index(stmt, pname), data);

case TEXT:
sqlite3_bind_text(stmt, sqlite3_bind_parameter_index(stmt, pname), value);

case NUMERIC:
    ??? I don't see a bind

This seems like something somebody would have come across before, so I'd rather not re-invent.

My questions are:
1. Is there already some other way of doing what I want? Or am I already on the right track?
2. If, is there already some enum or #define that would work for sqlType?
(SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_BLOB, SQLITE_NULL, SQLITE_TEXT don't seem to cover every DT)
3. What is the correct bind call for a NUMERIC parameter?

Thanks!!!
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to