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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 3 10:59:38 EST 2009


Author: jef
Date: 2009-11-03 10:59:38 -0500 (Tue, 03 Nov 2009)
New Revision: 11906

Modified:
   trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
Log:
make database (aka SID) optional for OCI connections

Modified: trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
===================================================================
--- trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	2009-11-03 15:56:27 UTC (rev 11905)
+++ trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	2009-11-03 15:59:38 UTC (rev 11906)
@@ -56,10 +56,22 @@
   }
   else if ( connectionType == "Oracle Spatial" )
   {
-    uri = "OCI:" + user + "/" + password
-          + "@" + host;
-          //MH 091102: connection to orcale does not seem to work with database name in uri
-          //+ "/" + database;
+    uri = "OCI:" + user;
+
+    if (( !user.isEmpty() && !password.isEmpty() ) ||
+        ( user.isEmpty() && password.isEmpty() ) )
+    {
+      uri += "/";
+      if ( !password.isEmpty() )
+        uri += password;
+    }
+
+    if ( !host.isEmpty() )
+    {
+      uri += "@" + host;
+      if ( !database.isEmpty() )
+        uri += "/" + database;
+    }
   }
   else if ( connectionType == "ODBC" )
   {



More information about the QGIS-commit mailing list