Opened 7 years ago

Closed 7 years ago

Last modified 7 years 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 by jerryfaust, 7 years ago

Component: defaultOGR_SF
Version: unspecified2.2.1

comment:2 by Even Rouault, 7 years ago

Cc: tamas added

comment:3 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 40100:

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

comment:4 by Even Rouault, 7 years ago

In 40101:

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

comment:5 by Even Rouault, 7 years ago

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.