> Oh you're right. I didn't read the Java API closely enough,

No, the story is more complex than that. The bug is in my example code
on usage.html, not in the driver.

SQLite works in seconds. Java works in milliseconds. My usage example
is entirely broken, as datetime(x, 'unixepoch') takes seconds, and
strftime('%s', x) returns seconds.

I need to update the example. I'll try and think of something elegant
later, but the short story is this needs to be done:

    prep = conn.prepareStatement(
        "insert into test values datetime(? / 1000, 'unixepoch');");
    prep.setDate(1, new Date(1092941466000));
    prep.executeUpdate();

    rs = stat.executeQuery("select * from test;");
    assert(rs.getString(1).equals("2004-08-19 18:51:06")));

    rs = stat.executeQuery("select strftime('%s', col1) * 1000 from test;");
    assert(rs.getDate(1).equals(new Date(987654321)));

d.

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to