Opened 14 years ago

Closed 6 years ago

#637 closed defect (fixed)

Can't get the PropertyName against the Sql Server Spatial

Reported by: hubu Owned by: hubu
Priority: blocker Milestone: 3.5.0
Component: SQLServer Spatial Version: 3.5.0
Severity: 2 Keywords:
Cc: External ID: 1291809

Description

  1. Studio connects to SQLSERVER 2008 :

Service: 10.148.203.71 user:sa psw:sql2008 Datastore:Road_concat

  1. Preview its Data - 5 features are listed in the table
  2. Preview its features

Result: A FDO exception throw:Invalid Stream Header

Expected: The 5 linestrings are displayed

The exception is thrown from FDORbmbsFeatureReader::GetPropertyNameForDataReader().

Attachments (1)

Fix Ticket #637.patch (1.1 KB ) - added by hubu 14 years ago.
code fix for this ticket

Download all attachments as: .zip

Change History (3)

by hubu, 14 years ago

Attachment: Fix Ticket #637.patch added

code fix for this ticket

comment:1 by hubu, 14 years ago

[Problem]: In MapGuide Studio, when connect to SQLSERVER Spatial, and preview the features in the feature editor, we will get a fdo exception "Invalid Stream Header". This problem only happens on Sqlserver spatial provider.

[Reason]: In the FdoRdbmsDataReader, the GetPropertyName functon is defined like this:

virtual FdoString* GetPropertyName(FdoInt32 index) {

EXECUTE_METHOD(GetPropertyNameForDataReader( index ));

}

When the FdoRdbmsDataReader::GetPropertyName() is invoked, actually the FDORbmbsFeatureReader::GetPropertyNameForDataReader() will be executed. And the FDORbmbsFeatureReader::GetPropertyNameForDataReader() is a virtual mothod.

The FdoRdbmsSqlServerOptimizedAggregateReader derived from FdoRdbmsFeatureReader. The problem is FdoRdbmsSqlServerOptimizedAggregateReader doesn't override the GetPropertyNameForDataReader(FdoInt32 index) mothod.

In this case, the FDORbmbsFeatureReader::GetPropertyNameForDataReader() is executed instead of the FdoRdbmsSqlServerOptimizedAggregateReader::GetPropertyNameForDataReader(). The method FDORbmbsFeatureReader::GetPropertyNameForDataReader() will invoke the FDORbmbsFeatureReader::GetPropertyCount() mothod to initialize the array mColList before using this array. But the FDORbmbsFeatureReader::GetPropertyCount() is overrided by the FdoRdbmsSqlServerOptimizedAggregateReader::GetPropertyCount(), in this override function, the mColList is not initialized. Then the execption happens when read the uninitialized array mColList.

[Solution]: Override the GetPropertyNameForDataReader(FdoInt32 index) mothod in the FdoRdbmsSqlServerOptimizedAggregateReader.

TESTING PERFORMED: Make sure the SQL Server spatial feature preview successfully.

comment:2 by jng, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.