@@ -749,7 +749,7 @@ bool QgsPostgresProvider::loadFields()
749
749
sql = QStringLiteral ( " SELECT oid,typname,typtype,typelem,typlen FROM pg_type" );
750
750
QgsPostgresResult typeResult ( connectionRO ()->PQexec ( sql ) );
751
751
752
- QMap<int , PGTypeInfo> typeMap;
752
+ QMap<Oid , PGTypeInfo> typeMap;
753
753
for ( int i = 0 ; i < typeResult.PQntuples (); ++i )
754
754
{
755
755
PGTypeInfo typeInfo =
@@ -759,20 +759,20 @@ bool QgsPostgresProvider::loadFields()
759
759
/* typeElem = */ typeResult.PQgetvalue ( i, 3 ),
760
760
/* typeLen = */ typeResult.PQgetvalue ( i, 4 ).toInt ()
761
761
};
762
- typeMap.insert ( typeResult.PQgetvalue ( i, 0 ).toInt (), typeInfo );
762
+ typeMap.insert ( typeResult.PQgetvalue ( i, 0 ).toUInt (), typeInfo );
763
763
}
764
764
765
765
766
- QMap<int , QMap<int , QString> > fmtFieldTypeMap, descrMap, defValMap, identityMap;
767
- QMap<int , QMap<int , int > > attTypeIdMap;
768
- QMap<int , QMap<int , bool > > notNullMap, uniqueMap;
766
+ QMap<Oid , QMap<int , QString> > fmtFieldTypeMap, descrMap, defValMap, identityMap;
767
+ QMap<Oid , QMap<int , Oid > > attTypeIdMap;
768
+ QMap<Oid , QMap<int , bool > > notNullMap, uniqueMap;
769
769
if ( result.PQnfields () > 0 )
770
770
{
771
771
// Collect table oids
772
- QSet<int > tableoids;
772
+ QSet<unsigned int > tableoids;
773
773
for ( int i = 0 ; i < result.PQnfields (); i++ )
774
774
{
775
- int tableoid = result.PQftable ( i );
775
+ Oid tableoid = result.PQftable ( i );
776
776
if ( tableoid > 0 )
777
777
{
778
778
tableoids.insert ( tableoid );
@@ -783,7 +783,7 @@ bool QgsPostgresProvider::loadFields()
783
783
{
784
784
QStringList tableoidsList;
785
785
const auto constTableoids = tableoids;
786
- for ( int tableoid : constTableoids )
786
+ for ( Oid tableoid : constTableoids )
787
787
{
788
788
tableoidsList.append ( QString::number ( tableoid ) );
789
789
}
@@ -805,12 +805,12 @@ bool QgsPostgresProvider::loadFields()
805
805
QgsPostgresResult fmtFieldTypeResult ( connectionRO ()->PQexec ( sql ) );
806
806
for ( int i = 0 ; i < fmtFieldTypeResult.PQntuples (); ++i )
807
807
{
808
- int attrelid = fmtFieldTypeResult.PQgetvalue ( i, 0 ).toInt ();
809
- int attnum = fmtFieldTypeResult.PQgetvalue ( i, 1 ).toInt ();
808
+ Oid attrelid = fmtFieldTypeResult.PQgetvalue ( i, 0 ).toUInt ();
809
+ int attnum = fmtFieldTypeResult.PQgetvalue ( i, 1 ).toInt (); // Int2
810
810
QString formatType = fmtFieldTypeResult.PQgetvalue ( i, 2 );
811
811
QString descr = fmtFieldTypeResult.PQgetvalue ( i, 3 );
812
812
QString defVal = fmtFieldTypeResult.PQgetvalue ( i, 4 );
813
- int attType = fmtFieldTypeResult.PQgetvalue ( i, 5 ).toInt ();
813
+ Oid attType = fmtFieldTypeResult.PQgetvalue ( i, 5 ).toUInt ();
814
814
bool attNotNull = fmtFieldTypeResult.PQgetvalue ( i, 6 ).toInt ();
815
815
bool uniqueConstraint = fmtFieldTypeResult.PQgetvalue ( i, 7 ).toInt ();
816
816
QString attIdentity = connectionRO ()->pgVersion () >= 100000 ? fmtFieldTypeResult.PQgetvalue ( i, 8 ) : " " ;
@@ -834,12 +834,12 @@ bool QgsPostgresProvider::loadFields()
834
834
if ( fieldName == mGeometryColumn )
835
835
continue ;
836
836
837
- int fldtyp = result.PQftype ( i );
837
+ Oid fldtyp = result.PQftype ( i );
838
838
int fldMod = result.PQfmod ( i );
839
839
int fieldPrec = -1 ;
840
- int tableoid = result.PQftable ( i );
840
+ unsigned int tableoid = result.PQftable ( i );
841
841
int attnum = result.PQftablecol ( i );
842
- int atttypid = attTypeIdMap[tableoid][attnum];
842
+ Oid atttypid = attTypeIdMap[tableoid][attnum];
843
843
844
844
const PGTypeInfo &typeInfo = typeMap.value ( fldtyp );
845
845
QString fieldTypeName = typeInfo.typeName ;
@@ -3232,7 +3232,7 @@ bool QgsPostgresProvider::setSubsetString( const QString &theSQL, bool updateFea
3232
3232
*/
3233
3233
long QgsPostgresProvider::featureCount () const
3234
3234
{
3235
- int featuresCounted = mShared ->featuresCounted ();
3235
+ long featuresCounted = mShared ->featuresCounted ();
3236
3236
if ( featuresCounted >= 0 )
3237
3237
return featuresCounted;
3238
3238
0 commit comments