Hi,
When I set the dateformat to unixepoch the maximum date I can get back from a 
query is 2038-01-19. This appears to be a problem in the wrapper as SQLite 
itself is using 64bit integers for dates.

You can reproduce the problem like this:

[Test]
public void ShouldDoSparseTimeSeriesTransform2()
{
    ExecuteNonQuery("CREATE TABLE Test_RAW (Date DATETIME, Id INT, Value INT, 
PRIMARY KEY (Date, Id))");
    ExecuteNonQuery("INSERT INTO Test_RAW VALUES(strftime('%s', '2038-01-20'), 
1, 1)");
    var result = ExecuteQuery("SELECT * FROM Test_RAW");
    // Set breakpoint here and inspect the result.
    Assert.AreEqual(1, result.Rows.Count);
}


private void ExecuteNonQuery(string command)

{

    using (var cmd = new SQLiteCommand(command, m_connection))

    {

        cmd.ExecuteNonQuery();

    }

}



private DataTable ExecuteQuery(string query)

{

    using (var cmd = new SQLiteCommand(query, m_connection))

    {

        using (var da = new SQLiteDataAdapter(cmd))

        {

            var dataTable = new DataTable();

            da.Fill(dataTable);

            return dataTable;

        }

    }

}


private SQLiteConnection m_connection;



internal static SQLiteConnection GetNewInMemoryConnection()

{

    var builder = new SQLiteConnectionStringBuilder

    {

        DataSource = ":memory:",

        DateTimeFormat = SQLiteDateFormats.UnixEpoch

    };

    return new SQLiteConnection(builder.ConnectionString);

}



[SetUp]

public void SetUp()

{

    m_connection = GetNewInMemoryConnection();

    m_connection.Open();

}



[TearDown]

public void TearDown()

{

    m_connection.Close();

    m_connection.Dispose();

}




Winton Capital Management Limited ("Winton") is a limited company registered in 
England and Wales with its registered offices at 16 Old Bailey, London, EC4M 
7EG (Registered Company No. 3311531). Winton is authorised and regulated by the 
Financial Conduct Authority in the United Kingdom, registered as an investment 
adviser with the US Securities and Exchange Commission, registered with the US 
Commodity Futures Trading Commission and a member of the National Futures 
Association in the United States.

This communication, including any attachments, is confidential and may be 
privileged. This email is for use by the intended recipient only. If you 
receive it in error, please notify the sender and delete it. You should not 
copy or disclose all or any part of this email.

This email does not constitute an offer or solicitation and nothing contained 
in this email constitutes, and should not be construed as, investment advice. 
Prospective investors should request offering materials and consult their own 
advisers with respect to investment decisions and inform themselves as to 
applicable legal requirements, exchange control regulations and taxes in the 
countries of their citizenship, residence or domicile. Past performance is not 
indicative of future results.

Winton takes reasonable steps to ensure the accuracy and integrity of its 
communications, including emails. However Winton accepts no liability for any 
materials transmitted. Emails are not secure and cannot be guaranteed to be 
error free. Winton handles personal information in accordance with our privacy 
notice.<https://www.wintoncapital.com/assets/documents/0239PrivacyPolicy.pdf>

Reply via email to