Skip to content

Commit ef838c7

Browse files
committed
fix #8099: useful error message on table_info
1 parent 13a86e6 commit ef838c7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/providers/spatialite/qgsspatialiteconnection.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle )
191191
// checking if table GEOMETRY_COLUMNS exists and has the expected layout
192192
ret = sqlite3_get_table( handle, "PRAGMA table_info(geometry_columns)", &results, &rows, &columns, &errMsg );
193193
if ( ret != SQLITE_OK )
194+
{
195+
mErrorMsg = tr( "table info on %1 failed" ).arg( "geometry_columns" );
194196
goto error;
197+
}
195198
if ( rows < 1 )
196199
;
197200
else
@@ -224,7 +227,10 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle )
224227
// checking if table SPATIAL_REF_SYS exists and has the expected layout
225228
ret = sqlite3_get_table( handle, "PRAGMA table_info(spatial_ref_sys)", &results, &rows, &columns, &errMsg );
226229
if ( ret != SQLITE_OK )
230+
{
231+
mErrorMsg = tr( "table info on %1 failed" ).arg( "spatial_ref_sys" );
227232
goto error;
233+
}
228234
if ( rows < 1 )
229235
;
230236
else
@@ -263,10 +269,10 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle )
263269

264270
error:
265271
// unexpected IO error
266-
mErrorMsg = tr( "unknown error cause" );
267-
if ( errMsg != NULL )
272+
if ( errMsg )
268273
{
269-
mErrorMsg = errMsg;
274+
mErrorMsg += "\n";
275+
mErrorMsg += errMsg;
270276
sqlite3_free( errMsg );
271277
}
272278
return false;
@@ -341,7 +347,7 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b
341347
case GAIA_VECTOR_GEOMETRYCOLLECTION:
342348
type = tr( "GEOMETRYCOLLECTION" );
343349
break;
344-
};
350+
}
345351
mTables.append( TableEntry( tableName, column, type ) );
346352

347353
lyr = lyr->Next;
@@ -683,7 +689,7 @@ bool QgsSpatiaLiteConnection::isDeclaredHidden( sqlite3 * handle, QString table,
683689
error:
684690
// unexpected IO error
685691
mErrorMsg = tr( "unknown error cause" );
686-
if ( errMsg != NULL )
692+
if ( errMsg )
687693
{
688694
mErrorMsg = errMsg;
689695
sqlite3_free( errMsg );

0 commit comments

Comments
 (0)