Skip to content
Permalink
Browse files

postgres provider: fix endianess detection

  • Loading branch information
jef-n committed Jun 21, 2011
1 parent a21e1db commit c4258c993b57a43427de5f6bacc8b05f71c1117b
Showing with 6 additions and 5 deletions.
  1. +1 −1 src/app/qgsidentifyresults.cpp
  2. +5 −4 src/providers/postgres/qgspostgresprovider.cpp
@@ -802,7 +802,7 @@ void QgsIdentifyResults::highlightFeature( QTreeWidgetItem *item )
if ( mHighlights.contains( featItem ) )
return;

int fid = featItem->data( 0, Qt::UserRole ).toInt();
QgsFeatureId fid = featItem->data( 0, Qt::UserRole ).toInt();

QgsFeature feat;
if ( !layer->featureAtId( fid, feat, true, false ) )
@@ -461,9 +461,10 @@ qint64 QgsPostgresProvider::getBinaryInt( PGresult *queryResult, int row, int co
QString buf = "";
for ( size_t i = 0; i < s; i++ )
{
buf += QString( "%1 " ).arg( *( char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
buf += QString( "%1 " ).arg( *( unsigned char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
}
QgsDebugMsg( QString( "int in hex:%1" ).arg( buf ) );

QgsDebugMsgLevel( QString( "int in hex:%1" ).arg( buf ), 3 );

switch ( s )
{
@@ -530,7 +531,7 @@ bool QgsPostgresProvider::getFeature( PGresult *queryResult, int row, bool fetch
try
{
QgsFeatureId oid = getBinaryInt( queryResult, row, 0 );
QgsDebugMsg( QString( "oid=%1" ).arg( oid ) );
QgsDebugMsgLevel( QString( "oid=%1" ).arg( oid ), 3 );

feature.setFeatureId( oid );
feature.clearAttributeMap();
@@ -3145,7 +3146,7 @@ bool QgsPostgresProvider::deduceEndian()
QgsDebugMsg( QString( "First oid is %1" ).arg( oidValue ) );

// compare the two oid values to determine if we need to do an endian swap
if ( oid == oidValue.toLongLong() )
if ( oid != oidValue.toLongLong() )
swapEndian = false;
}
connectionRO->closeCursor( "oidcursor" );

0 comments on commit c4258c9

Please sign in to comment.
You can’t perform that action at this time.