MapGuide API Reference
 All Classes Functions Variables Enumerations Enumerator Friends
virtual MgSqlDataReader* MgFeatureService::ExecuteSqlQuery ( MgResourceIdentifier resource,
CREFSTRING  sqlStatement,
MgParameterCollection parameters,
MgTransaction transaction 
) [pure virtual]

Executes the SQL SELECT statement on the specified feature source within the given transaction.

Remarks:
The XML returned by MgFeatureService::GetCapabilities says whether a provider supports SQL commands. See Provider Capabilities .
.NET Syntax
virtual MgSqlDataReader ExecuteSqlQuery(MgResourceIdentifier resource, string sqlStatement, MgParameterCollection parameters, MgTransaction transaction);
Java Syntax
virtual MgSqlDataReader ExecuteSqlQuery(MgResourceIdentifier resource, String sqlStatement, MgParameterCollection parameters, MgTransaction transaction);
PHP Syntax
virtual MgSqlDataReader ExecuteSqlQuery(MgResourceIdentifier resource, string sqlStatement, MgParameterCollection parameters, MgTransaction transaction);
Parameters:
resource(MgResourceIdentifier) A resource identifier referring to a feature source.
sqlStatement(String/string) The SQL SELECT statement.
parameters(MgParameterCollection) Parameters binded to the SQL statement.
transaction(MgTransaction) The MgTransaction instance on which the sql statement will be executed.
Returns:
Returns an MgSqlDataReader instance (or NULL).
Note:
If any statement other than SELECT is passed to this method, it will throw an MgFdoException.
Example (PHP)
 $sql = "select featid,abyte from featclass where featid = :id";
 $prop = new MgInt32Property("id", 150);
 $param = new MgParameter($prop);
 $params = new MgParameterCollection();
 $params->Add($param);
 $transaction = $featureService->BeginTransaction($activeFeatSrcResId);
 $sqlDataReader = $featureService->ExecuteSqlQuery($activeFeatSrcResId, $sql, $params, $transaction);
 $transaction->Commit();
Exceptions:
MgFeatureServiceException
MgInvalidArgumentException
MgInvalidOperationException
MgFdoException
Since:
2.2