Skip to content

Commit

Permalink
use both schema and table name retrieving oid, to fix #3329
Browse files Browse the repository at this point in the history
fixed endian deduction corrupted in r13340


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14919 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Dec 15, 2010
1 parent e4d18f5 commit de0a1f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,10 @@ bool QgsPostgresProvider::deduceEndian()
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
{
Expand All @@ -2972,6 +2974,7 @@ bool QgsPostgresProvider::deduceEndian()
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" );
Expand Down

0 comments on commit de0a1f8

Please sign in to comment.