Opened 15 years ago

Last modified 15 years ago

#644 new defect

Sqlite filtering on date returns wrong results

Reported by: bscott Owned by: traianstanev
Priority: major Milestone: 3.5.0
Component: SQLite Provider Version: 3.5.0
Severity: 3 Keywords:
Cc: External ID:

Description

Running our internal unit test i found some errors on date filtering. Our Unit test are runned against many FDO providers

SHP SDF Autodesk.Oracle King.Oracle PostGIS MySQL SqlServer

Our UnitTest returns the same result on date filtering except for Sqllite Tested on FeatureClass and Class

Table POINT structure

KEY_1 INTEGER DATE_1 TEXT

with fdo_columns.fdo_data_type = 2

Table POINT data KEY_1 DATE_1 1 2007-01-01T00:00:00.000 2 2007-01-02T00:00:00.000 99 2007-04-09T00:00:00.000 100 2007-04-10T00:00:00.000

Unit test Date and timestamp filter

Select KEY_1 from POINT where DATE_1 = DATE '2007-01-01'

failed returns nothing should return 1

Select KEY_1 from POINT where DATE_1 is null

ok

Select KEY_1 from POINT where DATE_1 is not null

ok

Select KEY_1 from POINT where DATE_1 > DATE '2007-04-09'

failed returns 99,100 should only return 100

Select KEY_1 from POINT where DATE_1 >= DATE '2007-04-09'

ok

Select KEY_1 from POINT where DATE_1 < DATE '2007-01-02'

ok

Select KEY_1 from POINT where DATE_1 <= DATE '2007-01-02'

failed return 1,2 should only return 1

Select KEY_1 from POINT where DATE_1 = TIMESTAMP '2007-01-01 00:00:00' ok Select KEY_1 from POINT where DATE_1 > TIMESTAMP '2007-04-09 00:00:00' ok Select KEY_1 from POINT where DATE_1 >= TIMESTAMP '2007-04-09 00:00:00' ok Select KEY_1 from POINT where DATE_1 < TIMESTAMP '2007-01-02 00:00:00' ok Select KEY_1 from POINT where DATE_1 <= TIMESTAMP '2007-01-02 00:00:00' ok

I have attached our unittest sqlite database on the ticket

Attachments (2)

UtFdoSQLite.zip (21.0 KB ) - added by bscott 15 years ago.
sqliteFilterOnDate.patch (491 bytes ) - added by bscott 15 years ago.

Download all attachments as: .zip

Change History (6)

by bscott, 15 years ago

Attachment: UtFdoSQLite.zip added

comment:1 by bscott, 15 years ago

Table POINT data ( well formated :) )

KEY_1 DATE_1

1 2007-01-01T00:00:00.000

2 2007-01-02T00:00:00.000

99 2007-04-09T00:00:00.000

100 2007-04-10T00:00:00.000

comment:2 by bscott, 15 years ago

Still got problem formating text in trac :(

All test using TIMESTAMP works fine : Select KEY_1 from POINT where DATE_1 = TIMESTAMP '2007-01-01 00:00:00'

ok

Select KEY_1 from POINT where DATE_1 > TIMESTAMP '2007-04-09 00:00:00'

ok

Select KEY_1 from POINT where DATE_1 >= TIMESTAMP '2007-04-09 00:00:00'

ok

Select KEY_1 from POINT where DATE_1 < TIMESTAMP '2007-01-02 00:00:00'

ok

Select KEY_1 from POINT where DATE_1 <= TIMESTAMP '2007-01-02 00:00:00'

ok

by bscott, 15 years ago

Attachment: sqliteFilterOnDate.patch added

comment:3 by bscott, 15 years ago

I have a little patch that fixes this defect (attached file sqliteFilterOnDate.patch) I have run all my unittest on it and it really seems to fix. Could you check it please

Thanks

comment:4 by traianstanev, 15 years ago

OK I'll take a look, but since I have some code which probably depends on this not having the 00:00:00, so I'd have to update more than just the provider, it will take me a few days.

Note: See TracTickets for help on using tickets.