[QGIS Commit] r14919 - trunk/qgis/src/providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Dec 15 16:59:30 EST 2010


Author: brushtyler
Date: 2010-12-15 13:59:30 -0800 (Wed, 15 Dec 2010)
New Revision: 14919

Modified:
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
use both schema and table name retrieving oid, to fix #3329
fixed endian deduction corrupted in r13340


Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-12-15 21:57:45 UTC (rev 14918)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-12-15 21:59:30 UTC (rev 14919)
@@ -2957,8 +2957,10 @@
     if ( i < PQnfields( res ) )
     {
       // get the table name
-      res = connectionRO->PQexec( QString( "SELECT relname FROM pg_class WHERE oid=%1" ).arg( oidValue ) );
-      query = QString::fromUtf8( PQgetvalue( res, 0, 0 ) );
+      res = connectionRO->PQexec( QString( "SELECT pg_namespace.nspname,pg_class.relname FROM pg_class,pg_namespace WHERE pg_class.relnamespace=pg_namespace.oid AND pg_class.oid=%1" ).arg( oidValue ) );
+      QString schemaName = QString::fromUtf8( PQgetvalue( res, 0, 0 ) );
+      QString tableName = QString::fromUtf8( PQgetvalue( res, 0, 1 ) );
+      query = quotedIdentifier( schemaName ) + "." + quotedIdentifier( tableName );
     }
     else
     {
@@ -2972,6 +2974,7 @@
     Result oidResult = connectionRO->PQexec( firstOid );
     // get the int value from a "normal" select
     oidValue = QString::fromUtf8( PQgetvalue( oidResult, 0, 0 ) );
+    query = mQuery;
   }
 
   QgsDebugMsg( "Creating binary cursor" );



More information about the QGIS-commit mailing list