>If all you have is a void*, you're going to have a very hard time calling any sqlite3_bind_*() function. yes, I just have all values with the type void*, so I can not choose which sqlite3_bind_*() functions to use.
Jay A. Kreibich-2 wrote: > > On Thu, Feb 04, 2010 at 06:41:46PM -0800, gujx scratched on the wall: >> >> Maybe I didn't express the problem clearly. >> > e.g. if you have a text value, you use _text(), if you have an int, you >> > use _int() > >> I just don't know what type I have, > > If all you have is a void*, you're going to have a very hard time > calling any sqlite3_bind_*() function. I sure hope you know what YOU > have, you're just not sure about the place you want to stick it. > >> so I want to get the meta type of the column somebody defined. > > One more time: columns don't have types. There is no way to get the > affinity (that I'm aware of) other than replicating code internal to > SQLite. Asking again won't change this. > >> e.g. I'd like to use a bind routine to bind a variable t to a "?", but I >> don't konw this t is a string or a number or it is a object, > > It doesn't matter. > >> so I want to >> know that the table is defined like "id(varchar)" ,then I will use >> sqlite3_bind_text; or it is defined like "id(integer)", then I will >> choose >> sqlite3_bind_int. > > I understand that, but you need to put something in the third > parameter. If you're going to call sqlite3_bind_text(), you need a > const char * for the third parameter. If you're going to call > sqlite3_bind_int(), you need an int for the third parameter. What > you have, in your C code, will best dictate what bind function to > use. SQLite will then do any conversions required, given the column > affinity, and it is generally going to do a better and smarter job > than your code can because it has more information about what is > going on. > >> > http://sqlite.org/datatype3.html >> > >> > Read this whole page. Several times. Make sure you understand it in >> > great detail. > > -j > > -- > Jay A. Kreibich < J A Y @ K R E I B I.C H > > > "Our opponent is an alien starship packed with atomic bombs. We have > a protractor." "I'll go home and see if I can scrounge up a ruler > and a piece of string." --from Anathem by Neal Stephenson > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://old.nabble.com/how-to-get-the-meta-type-of-a-column-tp27451326p27463630.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users