Skip to content

Commit 2700a3d

Browse files
author
jef
committedFeb 11, 2010
fix #2026
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12927 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8386fef commit 2700a3d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
 

‎src/app/ogr/qgsogrhelperfunctions.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,23 @@ QString createDatabaseURI( QString connectionType, QString host, QString databas
9797
uri += password;
9898
}
9999

100-
if ( !host.isEmpty() )
100+
if ( !host.isEmpty() || !database.isEmpty() )
101101
{
102-
uri += "@" + host;
102+
uri += "@";
103+
104+
if ( !host.isEmpty() )
105+
{
106+
uri += host;
107+
if ( !port.isEmpty() )
108+
uri += ":" + port;
109+
}
110+
103111
if ( !database.isEmpty() )
104-
uri += "/" + database;
112+
{
113+
if ( !host.isEmpty() )
114+
uri += "/";
115+
uri += database;
116+
}
105117
}
106118
}
107119
else if ( connectionType == "ODBC" )

0 commit comments

Comments
 (0)
Please sign in to comment.