Changes between Version 7 and Version 8 of FDORfc50
- Timestamp:
- 06/02/10 11:31:43 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FDORfc50
v7 v8 62 62 We will use some SQL examples just to illustrate things we are trying to achieve, each RBDMS-based provider will translate FDO selects in server side SQL depending of the server capabilities. 63 63 64 '' 'SELECT * FROM class1 AS p1, class2 AS p2 WHERE p1.ID=p2.!FeatId AND SPATIAL_COND(p1.GEOM, GEOM_VAL);'''64 ''SELECT * FROM class1 AS p1, class2 AS p2 WHERE p1.ID=p2.!FeatId AND SPATIAL_COND(p1.GEOM, GEOM_VAL);'' 65 65 66 66 Below we added some C++ code on how caller can use this new improvement to achieve above select statement: … … 84 84 }}} 85 85 86 '''Note:''' In the base class we have a method named !GetFeatureClassName, in case caller will use it and the !FdoIdentifier is not added into !GetFeatureClassNames we can add it at Execute time. 87 88 89 === Handle Joins === 86 ''Note:'' In the base class we have a method named !GetFeatureClassName, in case caller will use it and the !FdoIdentifier is not added into !GetFeatureClassNames we can add it at Execute time. 87 88 === Handling Joins === 90 89 91 90 Below we define new classes to define and use a join criteria used in the join select. … … 180 179 Join criteria will be used to generate join SQL commands, like: 181 180 182 '' 'SELECT p.!FeatId AS xFID,p.Geometry,pxy.Name,pxy.X,pxy.Y,pex.NameB,pex.Link FROM p '''[[BR]]183 '' 'INNER JOIN pxy ON(p.!FeatId = pxy.!FeatId)'''[[BR]]184 '' 'INNER JOIN pex ON(pex.FID = pxy.!FeatId)'''[[BR]]185 '' 'WHERE p.!FeatId >= 0;'''[[BR]]181 ''SELECT p.!FeatId AS xFID,p.Geometry,pxy.Name,pxy.X,pxy.Y,pex.NameB,pex.Link FROM p ''[[BR]] 182 ''INNER JOIN pxy ON(p.!FeatId = pxy.!FeatId)''[[BR]] 183 ''INNER JOIN pex ON(pex.FID = pxy.!FeatId)''[[BR]] 184 ''WHERE p.!FeatId >= 0;''[[BR]] 186 185 187 186 Below we added some C++ code on how caller can use this new improvement to achieve above select statement: … … 245 244 Named sub-select will be used to generate SQL commands, like: 246 245 247 '' 'SELECT * FROM point WHERE !FeatId IN (SELECT pt.!FeatId FROM pt WHERE pt.!FeatId >= 2 AND SPATIAL_COND(pt.GEOM, GEOM_VAL));'''246 ''SELECT * FROM point WHERE !FeatId IN (SELECT pt.!FeatId FROM pt WHERE pt.!FeatId >= 2 AND SPATIAL_COND(pt.GEOM, GEOM_VAL));'' 248 247 249 248 In above case we will have two selects having following filters: 250 * Main select: “!FeatId IN(:SUBSEL)”251 * Sub-select: “pt.!FeatId >= 2 AND SPATIAL_COND(pt.GEOM, GEOM_VAL)”249 * Main select: !FeatId IN(:SUBSEL) 250 * Sub-select: pt.!FeatId >= 2 AND SPATIAL_COND(pt.GEOM, GEOM_VAL) 252 251 253 252 Below we added some C++ code on how caller can use this new improvement to achieve above select statement: … … 276 275 }}} 277 276 278 In order to be able to support sub-selects for '''IN''' operator we need provide a way to pass it through FDO Filter and make the parser to recognize the filter, since FDO Filter parser don’t know SQL syntax. The best way to achieve that is to pass a parameter in the filter, e.g.: '' '!FeatId IN(:PARAM)'''. This parameter will be replaced by the provider at execution time by the sub-select. This way we improve IN() operator in FDO to handle sub-selects.277 In order to be able to support sub-selects for '''IN''' operator we need provide a way to pass it through FDO Filter and make the parser to recognize the filter, since FDO Filter parser don’t know SQL syntax. The best way to achieve that is to pass a parameter in the filter, e.g.: ''!FeatId IN(:PARAM)''. This parameter will be replaced by the provider at execution time by the sub-select. This way we improve IN() operator in FDO to handle sub-selects. 279 278 280 279