qgspostgresprovider.cpp (QGIS-final-3_10_11) | : | qgspostgresprovider.cpp (QGIS-final-3_10_12) | ||
---|---|---|---|---|
skipping to change at line 3646 | skipping to change at line 3646 | |||
tableName = mQuery; | tableName = mQuery; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
mValid = false; | mValid = false; | |||
return false; | return false; | |||
} | } | |||
} | } | |||
QString detectedType = mRequestedGeomType == QgsWkbTypes::Unknown ? QString() : QgsPostgresConn::postgisWkbTypeName( mRequestedGeomType ); | QString detectedType; | |||
QString detectedSrid = mRequestedSrid; | QString detectedSrid = mRequestedSrid; | |||
if ( !schemaName.isEmpty() ) | if ( !schemaName.isEmpty() ) | |||
{ | { | |||
// check geometry columns | // check geometry columns | |||
sql = QStringLiteral( "SELECT upper(type),srid,coord_dimension FROM geometry _columns WHERE f_table_name=%1 AND f_geometry_column=%2 AND f_table_schema=%3" ) | sql = QStringLiteral( "SELECT upper(type),srid,coord_dimension FROM geometry _columns WHERE f_table_name=%1 AND f_geometry_column=%2 AND f_table_schema=%3" ) | |||
.arg( quotedValue( tableName ), | .arg( quotedValue( tableName ), | |||
quotedValue( geomCol ), | quotedValue( geomCol ), | |||
quotedValue( schemaName ) ); | quotedValue( schemaName ) ); | |||
QgsDebugMsg( QStringLiteral( "Getting geometry column: %1" ).arg( sql ) ); | QgsDebugMsg( QStringLiteral( "Getting geometry column: %1" ).arg( sql ) ); | |||
result = connectionRO()->PQexec( sql ); | result = connectionRO()->PQexec( sql ); | |||
QgsDebugMsg( QStringLiteral( "Geometry column query returned %1 rows" ).arg( result.PQntuples() ) ); | QgsDebugMsg( QStringLiteral( "Geometry column query returned %1 rows" ).arg( result.PQntuples() ) ); | |||
if ( result.PQntuples() == 1 ) | if ( result.PQntuples() == 1 ) | |||
{ | { | |||
QString dt = result.PQgetvalue( 0, 0 ); | detectedType = result.PQgetvalue( 0, 0 ); | |||
if ( dt != "GEOMETRY" ) detectedType = dt; | ||||
QString dim = result.PQgetvalue( 0, 2 ); | QString dim = result.PQgetvalue( 0, 2 ); | |||
if ( dim == QLatin1String( "3" ) && !detectedType.endsWith( 'M' ) ) | if ( dim == QLatin1String( "3" ) && !detectedType.endsWith( 'M' ) ) | |||
detectedType += QLatin1String( "Z" ); | detectedType += QLatin1String( "Z" ); | |||
else if ( dim == QLatin1String( "4" ) ) | else if ( dim == QLatin1String( "4" ) ) | |||
detectedType += QLatin1String( "ZM" ); | detectedType += QLatin1String( "ZM" ); | |||
QString ds = result.PQgetvalue( 0, 1 ); | QString ds = result.PQgetvalue( 0, 1 ); | |||
if ( ds != QLatin1String( "0" ) ) detectedSrid = ds; | if ( ds != QLatin1String( "0" ) ) detectedSrid = ds; | |||
mSpatialColType = SctGeometry; | mSpatialColType = SctGeometry; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added |