Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1135 closed defect (fixed)

Feature Service API throws exception on executing some SQL's

Reported by: Aleck Owned by: Aleck
Priority: low Milestone: 2.2
Component: Feature Service Version: 2.1.0
Severity: trivial Keywords:
Cc: External ID:

Description

  1. Connect to an Oracle datastore

Executes a SQL statement like the following: "select (max(f.id))+1 from table f";

You will get an MgFdoException:

This is becuase in MgServerFeatureUtil::GetMgProperty method, it is assumed that the property name will be in the form of [TableName].[FieldName]. And only the FieldName part will be used as the property name to get the property value through FDO.

However, this assumption is not necessary and even not correct. Take the above SQL statement as an example. the property name returned by FDO is "(max(f.id))+1". However, only the part "id))+1" is used as the property name. Thus exception occurs.

To fix this, the code that splits the assumed qualified property name is removed. The property name returned by FDO should be used directly to get the property value.

Attachments (1)

fix.patch (9.2 KB ) - added by Aleck 15 years ago.

Download all attachments as: .zip

Change History (5)

by Aleck, 15 years ago

Attachment: fix.patch added

comment:1 by crispinatime, 15 years ago

Hi - can I ask if this will address the more generic casting of column names such as:

select (max(f.id))+1 NextID from table f

or

select (max(f.id))+1 AS NextID from table f

comment:2 by Aleck, 15 years ago

Well, if an AS clause is provided for the selected field name such as the sql statement "select (max(f.id))+1 AS NextID from table f", everything goes OK. That is because for these statements,the provider will return the user defined field name in AS clause as the property name such as "NextID" in the above case. In this circumstance, there will be no dot in the property name text, therefore, feature service is able to handle this.

What I'm addressing in this ticket is that a property name containing a dot will raise this issue. that is to say a statement like "select (max(f.id))+1 from table f"

comment:3 by brucedechant, 15 years ago

Milestone: 2.2
Resolution: fixed
Status: newclosed
Version: 2.0.22.1.0

Fixed in trunk r4333.

comment:4 by brucedechant, 15 years ago

Component: GeneralFeature Service
Note: See TracTickets for help on using tickets.