Skip to content

Commit 4a3d3db

Browse files
committedJan 29, 2016
Improve handling of geometryless tables in browser
1 parent e830c23 commit 4a3d3db

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎src/providers/mssql/qgsmssqldataitems.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ bool QgsMssqlConnectionItem::handleDrop( const QMimeData* data, const QString& t
377377
tableName = u.name;
378378
}
379379

380-
QString uri = connInfo() + " table=" + tableName + " (geom)";
380+
QString uri = connInfo() + " table=" + tableName;
381+
if ( srcLayer->geometryType() != QGis::NoGeometry )
382+
uri += " (geom)";
381383

382384
QgsVectorLayerImport::ImportError err;
383385
QString importError;

‎src/providers/postgres/qgspostgresdataitems.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema )
222222

223223
if ( srcLayer->isValid() )
224224
{
225-
uri.setDataSource( QString(), u.name, "geom" );
225+
uri.setDataSource( QString(), u.name, srcLayer->geometryType() != QGis::NoGeometry ? "geom" : QString() );
226226
QgsDebugMsg( "URI " + uri.uri( false ) );
227227

228228
if ( !toSchema.isNull() )

0 commit comments

Comments
 (0)
Please sign in to comment.