Opened 6 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

#7039 closed defect (fixed)

OGRMSSQLSpatialTableLayer::DeleteFeature fails with schema prefix

Reported by: jerryfaust Owned by: warmerdam
Priority: normal Milestone: 2.2.2
Component: OGR_SF Version: 2.2.1
Severity: normal Keywords: mssql
Cc: tamas

Description

The SQL DELETE statement is placing square brackets around the table name, which if containing a schema prefix, is improperly formatted.

DELETE FROM [schema.table] should instead be DELETE FROM [schema].[table]

I replaced the original statement (at line 1153):

oStatement.Appendf("DELETE FROM [%s] WHERE [%s] = " CPL_FRMT_GIB,

poFeatureDefn->GetName?(), pszFIDColumn, nFID);

with

oStatement.Appendf("DELETE FROM [%s].[%s] WHERE [%s] = " CPL_FRMT_GIB,

pszSchemaName, pszTableName, pszFIDColumn, nFID);

Change History (5)

comment:1 Changed 6 weeks ago by jerryfaust

Component: defaultOGR_SF
Version: unspecified2.2.1

comment:2 Changed 6 weeks ago by Even Rouault

Cc: tamas added

comment:3 Changed 6 weeks ago by Even Rouault

Resolution: fixed
Status: newclosed

In 40100:

MSSQLSpatial: properly format DELETE statement with schema (patch by jerryfaust, fixes #7039)

comment:4 Changed 6 weeks ago by Even Rouault

In 40101:

MSSQLSpatial: properly format DELETE statement with schema (patch by jerryfaust, fixes #7039)

comment:5 Changed 6 weeks ago by Even Rouault

Keywords: mssql added
Milestone: 2.2.2

Tamas, I've taken the liberty to apply the patch suggested by the reporter, which looks consistant with other part of the code. I didn't test myself more than compiling.

Note: See TracTickets for help on using tickets.