Skip to content

Commit

Permalink
Enable evaluation of primary key if table name is given in the format…
Browse files Browse the repository at this point in the history
… schema.tablename

SQL server plugin allows to omit "USING UNIQUE" by automatically
retrieving the name of the table's primary key. This did only work if
the table was just mentioned through it name. The fix allows you to
specify the table name as
[SERVERNAME].[DATABASENAME].[SCHEMANAME].[TABLENAME]
  • Loading branch information
micking committed Jan 20, 2017
1 parent 3432a4e commit ea90efe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mapmssql2008.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ int msMSSQL2008LayerRetrievePK(layerObj *layer, char **urid_name, char* table_na
" sys.tables ON sys.indexes.object_id = sys.tables.object_id INNER JOIN "
" sys.index_columns ON sys.indexes.object_id = sys.index_columns.object_id AND sys.indexes.index_id = sys.index_columns.index_id ON "
" sys.columns.object_id = sys.index_columns.object_id AND sys.columns.column_id = sys.index_columns.column_id "
"WHERE (sys.indexes.is_primary_key = 1) AND (sys.tables.name = N'%s') ",
"WHERE (sys.indexes.is_primary_key = 1) AND (sys.tables.name = PARSENAME(N'%s',1)) ",
table_name);

if (debug) {
Expand Down

0 comments on commit ea90efe

Please sign in to comment.