Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5155 closed defect (fixed)

MSSQL Spatial Plain Tables (No Geometry)

Reported by: jpalmer Owned by: tamas
Priority: normal Milestone: 1.11.0
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

When trying to create a table without a geometry column using the MSSQLSpatial driver no table is created and no error is thrown.

e.g (Python API):

layer = ds.CreateLayer?('my_table', srs = None, geom_type = ogr.wkbNone, options = OVERWRITE=YES?)

In this case the CreateLayer? method returns successfully with a valid layer object.

I've tracked this down to this code:

http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp#L304

As a minimum the logic should be changed to throw an error if wkbNone is used for the layer geometry type.

However why not allow geometryless tables be created? Just about all of the other database driver allow this.

Attachments (1)

mssql_plain_tables_support.diff (10.1 KB) - added by jpalmer 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by jpalmer

comment:1 Changed 4 years ago by jpalmer

I've attached a patch that implements support for listing, reading and writing non spatial user tables using the MSSQLSpatial driver. The user must set the MSSQLSPATIAL_LIST_ALL_TABLES=YES configuration option to be able to read and list non spatial tables.

In addition I have fixed a bug with ODBC driver complaining about not allowing multiple active query statements per connection. This bug occurred because one query statement was not completed/cleared if the tables had a primary keys with more than 2 columns.

comment:2 Changed 4 years ago by tamas

Milestone: 1.10.12.0
Resolution: fixed
Status: newclosed

Just committed the modifications in trunk (r26394, r26395)

comment:3 Changed 4 years ago by Even Rouault

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.