Opened 12 years ago

Closed 7 years ago

#852 closed defect (fixed)

Cannot insert features into SQL Server

Reported by: jng Owned by: RomicaDascalescu
Priority: blocker Milestone: 3.7.0
Component: SQLServer Spatial Version: 3.7.0
Severity: 1 Keywords:
Cc: gBecker External ID:

Description

There is a showstopping defect in the SQL Server provider that makes it impossible to insert features into a SQL Server Feature Source in MapGuide in both transactional and non-transactional modes.

Attached is a simple .net program demonstrating the problem

The MapGuideTest data store is a foreign schema with a table GeomTest, created with the following DDL:

CREATE TABLE [dbo].[GeomTest](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Geom] [geometry] NULL,
 CONSTRAINT [PK_GeomTest] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE SPATIAL INDEX [SPATIAL_GeomTest] ON [dbo].[GeomTest] 
(
	[Geom]
)USING  GEOMETRY_GRID 
WITH (
BOUNDING_BOX =(3462000, 5542000, 3486000, 5566000), GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM), 
CELLS_PER_OBJECT = 16, PAD_INDEX  = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

Attachments (3)

Program.cs (4.5 KB ) - added by jng 12 years ago.
.net test program source
SQLServerPatch.patch (670 bytes ) - added by RomicaDascalescu 12 years ago.
852_idprops.patch (902 bytes ) - added by jng 12 years ago.
Patch to include identity properties

Download all attachments as: .zip

Change History (8)

by jng, 12 years ago

Attachment: Program.cs added

.net test program source

comment:1 by jng, 12 years ago

This defect is present in:

  • MapGuide Open Source 2.4 (using HEAD FDO 3.7 revision of the provider)
  • MapGuide Open Source trunk (using HEAD FDO trunk revision of the provider)

by RomicaDascalescu, 12 years ago

Attachment: SQLServerPatch.patch added

comment:2 by RomicaDascalescu, 12 years ago

Owner: changed from danstoica to RomicaDascalescu

Hi,

The reader is using a flag to detect if caller called ReadNext or not. This flag was added to the GetClassDefinition() by mistake and because of that is caller do not call ReadNext() upfront will get an exception. To fix this issue just remove the flag check from GetClassDefinition().

One other way to avoid this would be to call read next and after that GetClassDefinition().

I've attached the patch to fix this. The patch will be dropped shortly in Fdo 3.8 stream.

Thanks, Romy.

by jng, 12 years ago

Attachment: 852_idprops.patch added

Patch to include identity properties

comment:3 by jng, 12 years ago

Hi Romy,

Confirmed that this patch removes that particular error message. However, this triggers a new error (MgInsertError in MapGuide, here). That error is triggered by class definition not containing any identity properties. From what I've seen in the FdoRdbmsFeatureInfoReader, the class definition that is created and returned in GetClassDefinition() does not check for this, so the class definition that is returned to MapGuide has no identity properties and triggers the MgInsertError

I've attached a patch to populate the identity properties of the class definition that's returned. Not sure if I'm correctly using the FdoSmLp classes here. My test seems to say yes.

comment:4 by romicadascalescu, 12 years ago

Hi,

Your changes look OK, you can drop the change. On our side we check properties and not the primary keys in the class returned after insert is executed. Please be aware that this class will not be a full class definition, it will contain primary keys and auto-generated properties only.

Thanks, Romy

comment:5 by jng, 7 years ago

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