[fdo-users] FDO SDF Defect : can't filter on date

Bruno Scott bscott at geomapgis.com
Thu Jan 3 06:34:42 EST 2008


Thanks for the reply
I have made some testing with you suggestion
I have try this

select MYKEY from MYTABLE where MYDATE = TIMESTAMP '2007-01-01 00:00:00'
and it return the expected result ( only one record)

i have also try this one
select MYKEY from MYTABLE where MYDATE = DATE '2007-01-01'
and it return no record

I was on the way and i have also tried order stuf
My test database have 100 records
starting with 2007-01-01 then 2007-01-02 and so on

select MYKEY from MYTABLE where MYDATE > TIMESTAMP '2007-01-01 00:00:00'
no record are returned ( should be 99 records in my test database)

select MYKEY from MYTABLE where MYDATE >= TIMESTAMP '2007-01-01 00:00:00'
1 record is returned ( should be 100 records in my test database)

select MYKEY from MYTABLE where MYDATE < TIMESTAMP '2007-01-01 00:00:00'
99 record is returned ( All record except the one that is 2007-01-01)

select MYKEY from MYTABLE where MYDATE <= TIMESTAMP '2007-01-01 00:00:00'
100 record is returned ( All record are returned)

all these test return the expected result with the MySQL provider
and they are using the exact same code



Romica Dascalescu wrote:
> 
> You should use one of the keywords depending of the provided text content
> DATE                    - in case you have only a date (your case)
> TIME                    - in case you have only a time
> TIMESTAMP               - in case you have a datetime
> 
> E.G.:
> FdoFilter::Parse(L"MYDATE = DATE '2007-01-01'")
> 
> Romy.
> 
> -----Original Message-----
> From: fdo-users-bounces at lists.osgeo.org
> [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Badreddine Karoui
> Sent: Wednesday, January 02, 2008 11:12 AM
> To: FDO Users Mail List
> Subject: RE: [fdo-users] FDO SDF Defect : can't filter on date
> 
> You should be using the string format of the FdoDateTime class as:
> 
> select->SetFilter(FdoPtr<FdoFilter>(FdoFilter::Parse(L"datetime =
> TIMESTAMP '2006-04-21 19:40:10.0001'")));
> 
> The above line is taken from the SDF provider unit test.
> 
> Badreddine
> 
> -----Original Message-----
> From: fdo-users-bounces at lists.osgeo.org
> [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Bruno Scott
> Sent: Wednesday, January 02, 2008 8:32 AM
> To: fdo-users at lists.osgeo.org
> Subject: [fdo-users] FDO SDF Defect : can't filter on date
> 
> 
> I try to execute this type of query
> select MYKEY from MYTABLE where MYDATE = 2007-01-01'
> 
> The query execution works fine but as soon as i try to fetch the first
> record
> i got this exception "Cannot convert string to DateTime"
> 
> Sample code:
> FdoPtr<FdoISelect>            sampleSelect;
> FdoPtr<FdoIFeatureReader> sampleFeatureReader;
> sampleSelect = (FdoISelect
> *)m_connection->CreateCommand(FdoCommandType_Select);
> sampleSelect->SetFeatureClassName(_T("MYTABLE"));
> sampleSelect->SetFilter(_T("MYDATE = 2007-01-01'"));
> FdoPtr<FdoIdentifier>queryPropertyName =
> FdoIdentifier::Create(_T("MYKEY"));
> FdoPtr<FdoIdentifierCollection> propertyCollection =
> sampleSelect->GetPropertyNames();
> propertyCollection->Add(queryPropertyName);
> sampleFeatureReader = sampleSelect->Execute();
> sampleFeatureReader->ReadNext() // this line throw the exception
> 
> I have the same problem if i use FdoISelectAggregates
> 
> Bruno
> --
> View this message in context:
> http://www.nabble.com/FDO-SDF-Defect-%3A-can%27t-filter-on-date-tp14578427s18162p14578427.html
> Sent from the fdo-users mailing list archive at Nabble.com.
> 
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> 
> 

-- 
View this message in context: http://www.nabble.com/FDO-SDF-Defect-%3A-can%27t-filter-on-date-tp14578427s18162p14595571.html
Sent from the fdo-users mailing list archive at Nabble.com.



More information about the fdo-users mailing list