"Bharath Booshan L" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1. Can I use sqlite3_prepare_v2 in Version 3.1.3?
No. It was introduced in v3.3.9 > 2. How do I bind date values using prepare/bind methods? SQLite doesn't have dedicated date or time types. You may choose to store timestamps as strings, as julian dates (floating point numbers) or as Unix epoch timestamps (integers). See also http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions > Eg: INSERT INTO TABLE Info(Name,DOB) > values('XYZ',julianday('1984-03-03')); > > For above example I can write a prepared statement as > > INSERT INTO TABLE Info(Name,DOB) values(?,julianday(?)) Here, you are replacing two string literals with parameter placeholders. So you bind them as strings. > But how do I write prepared statement if I want to insert date('now') > value into the table, like below query > > INSERT INTO TABLE Info(Name,DOB) values('XYZ',julianday(date('now')) julianday('now') would work just as well. So you can use your first statement, and bind 'now' for the parameter. > I am asking this because julianday(date('1984-03-03')) = > julianday('1984-03-03'). Right? Right. In fact, date('1984-03-03') is a no-op: the result of date('1984-03-03') is simply '1984-03-03'. Though I fail to see how this fact is relevant to your original question. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users