[fdo-users] FDO MySQL defect with SelectAggregates

Bruno Scott bscott at geomapgis.com
Fri Dec 28 05:59:31 EST 2007


I'm trying to do that type of sql statement : "select Count(1) from POINT
where NOT POINT.KEY_1 NULL"
Using the MySQL provider

This is my code
FdoPtr<FdoIBaseSelect>        baseSelectPtr;
baseSelectPtr =
(FdoIBaseSelect*)connectionPtr->CreateCommand(FdoCommandType_SelectAggregates);

baseSelectPtr->SetFeatureClassName("POINT");
baseSelectPtr->SetFilter("NOT POINT.KEY_1 NULL");

FdoPtr<FdoComputedIdentifier> queryComputedIdentifier;
queryComputedIdentifier =
FdoComputedIdentifier::Create("Count(1)",FdoExpression::Parse("Count(1)"));

FdoPtr<FdoIdentifierCollection> propertyCollection = 
baseSelectPtr->GetPropertyNames();
propertyCollection->Add(queryComputedIdentifier);

FdoPtr<FdoISelectAggregates> selectAggregatePtr  =
(FdoISelectAggregates*)baseSelectPtr.Detach();
FdoPtr<FdoIDataReader> dataReaderPtr       = selectAggregatePtr->Execute();

This thing throw me an exception:
RDBMS: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 
'Count(1) FROM "fdomysqladsk"."point" H WHERE  (  NOT  ( H."key_1" IS NULL  
)   ' at line 1 

i've tried this syntax inside MySql and it throws me the same error.
But if we replace all " by ` it works
wrong : select Count(1) FROM "fdomysqladsk"."point" H WHERE  NOT  H."key_1"
IS NULL
good: select Count(1) FROM `fdomysqladsk`.`point` H WHERE  NOT  H.`key_1` IS
NULL

Bruno


-- 
View this message in context: http://www.nabble.com/FDO-MySQL-defect-with-SelectAggregates-tp14524443s18162p14524443.html
Sent from the fdo-users mailing list archive at Nabble.com.



More information about the fdo-users mailing list