[QGIS Commit] r12927 - trunk/qgis/src/app/ogr

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Feb 11 07:36:37 EST 2010


Author: jef
Date: 2010-02-11 07:36:37 -0500 (Thu, 11 Feb 2010)
New Revision: 12927

Modified:
   trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
Log:
fix #2026

Modified: trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
===================================================================
--- trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	2010-02-11 12:18:17 UTC (rev 12926)
+++ trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	2010-02-11 12:36:37 UTC (rev 12927)
@@ -97,11 +97,23 @@
         uri += password;
     }
 
-    if ( !host.isEmpty() )
+    if ( !host.isEmpty() || !database.isEmpty() )
     {
-      uri += "@" + host;
+      uri += "@";
+
+      if ( !host.isEmpty() )
+      {
+        uri += host;
+        if ( !port.isEmpty() )
+          uri += ":" + port;
+      }
+
       if ( !database.isEmpty() )
-        uri += "/" + database;
+      {
+        if ( !host.isEmpty() )
+          uri += "/";
+        uri += database;
+      }
     }
   }
   else if ( connectionType == "ODBC" )



More information about the QGIS-commit mailing list