[QGIS Commit] r13424 - trunk/qgis/src/providers/postgres
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed May 5 04:39:32 EDT 2010
Author: jef
Date: 2010-05-05 04:39:31 -0400 (Wed, 05 May 2010)
New Revision: 13424
Modified:
trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
minor pg provider fix: oid==0 is invalid
Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2010-05-05 08:00:19 UTC (rev 13423)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2010-05-05 08:39:31 UTC (rev 13424)
@@ -853,7 +853,7 @@
QString fieldElem = QString::fromUtf8( PQgetvalue( oidResult, 0, 2 ) );
int fieldSize = QString::fromUtf8( PQgetvalue( oidResult, 0, 3 ) ).toInt();
- if ( tableoid >= 0 )
+ if ( tableoid > 0 )
{
sql = QString( "SELECT attnum FROM pg_attribute WHERE attrelid=%1 AND attname=%2" )
.arg( tableoid ).arg( quotedValue( fieldName ) );
@@ -2940,7 +2940,7 @@
for ( i = 0; i < PQnfields( res ); i++ )
{
int tableoid = PQftable( res, i );
- if ( tableoid >= 0 )
+ if ( tableoid > 0 )
{
oidValue = QString::number( tableoid );
break;
@@ -3016,13 +3016,13 @@
Result result = connectionRO->PQexec( sql );
if ( PGRES_TUPLES_OK == PQresultStatus( result ) )
{
- Oid tableOid = PQftable( result, 0 );
+ Oid tableoid = PQftable( result, 0 );
int column = PQftablecol( result, 0 );
result = connectionRO->PQexec( sql );
- if ( tableOid >= 0 && PGRES_TUPLES_OK == PQresultStatus( result ) )
+ if ( tableoid > 0 && PGRES_TUPLES_OK == PQresultStatus( result ) )
{
- sql = 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( tableOid );
+ sql = 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( tableoid );
result = connectionRO->PQexec( sql );
if ( PGRES_TUPLES_OK == PQresultStatus( result ) && 1 == PQntuples( result ) )
@@ -3030,17 +3030,17 @@
schemaName = QString::fromUtf8( PQgetvalue( result, 0, 0 ) );
tableName = QString::fromUtf8( PQgetvalue( result, 0, 1 ) );
- sql = QString( "SELECT attname FROM pg_attribute WHERE attrelid=%1 AND attnum=%2" ).arg( tableOid ).arg( column );
+ sql = QString( "SELECT attname FROM pg_attribute WHERE attrelid=%1 AND attnum=%2" ).arg( tableoid ).arg( column );
result = connectionRO->PQexec( sql );
if ( PGRES_TUPLES_OK == PQresultStatus( result ) && 1 == PQntuples( result ) )
{
geomCol = QString::fromUtf8( PQgetvalue( result, 0, 0 ) );
}
- else
- {
- schemaName = mSchemaName;
- tableName = mTableName;
- }
+ else
+ {
+ schemaName = mSchemaName;
+ tableName = mTableName;
+ }
}
}
}
More information about the QGIS-commit
mailing list