[fdo-users] FDO MySQL defect with SelectAggregates

Bruno Scott bscott at geomapgis.com
Fri Dec 28 09:00:16 EST 2007


I have more information and i have found a workaround :)
I have the same problem if we use standard FDOIselect command
The problem is with the computed name
instead of
FdoComputedIdentifier::Create("Count(1)",FdoExpression::Parse("Count(1)"));
if i use this
FdoComputedIdentifier::Create("SomeName",FdoExpression::Parse("Count(1)"));
it works!

But it's only a workaround, the MySQL provider should use the native MySQL `
instead of "
so we could have any type of generic name for computed field

Bruno




Bruno Scott wrote:
> 
> 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-tp14524443s18162p14526043.html
Sent from the fdo-users mailing list archive at Nabble.com.



More information about the fdo-users mailing list