Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make the various spit error messages more informative to aid the poor
souls who find that spit generates a fairly unhelpful error message
and fails to import any shape files.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5963 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 16, 2006
1 parent ec0fbd4 commit 11092eb
Showing 1 changed file with 55 additions and 18 deletions.
73 changes: 55 additions & 18 deletions src/plugins/spit/qgsspit.cpp
Expand Up @@ -568,8 +568,12 @@ void QgsSpit::import()
rel_exists1 = ( PQntuples( res ) > 0 );
if ( PQresultStatus( res ) != PGRES_TUPLES_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand All @@ -585,8 +589,13 @@ void QgsSpit::import()
rel_exists2 = ( PQntuples( res ) > 0 );
if ( PQresultStatus( res ) != PGRES_TUPLES_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );

pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand All @@ -600,8 +609,12 @@ void QgsSpit::import()
res = PQexec( pd, query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand All @@ -619,9 +632,13 @@ void QgsSpit::import()
qWarning( query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QString err = PQresultErrorMessage( res );
qWarning( err );
qWarning( PQresStatus( PQresultStatus( res ) ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand Down Expand Up @@ -655,8 +672,12 @@ void QgsSpit::import()
res = PQexec( pd, ( const char * ) query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand All @@ -676,8 +697,12 @@ void QgsSpit::import()
res = PQexec( pd, ( const char * ) query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
continue;
}
Expand All @@ -693,8 +718,12 @@ void QgsSpit::import()
res = PQexec( pd, query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
}
else
{
Expand All @@ -715,8 +744,12 @@ void QgsSpit::import()
res = PQexec( pd, query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
continue;
}
else
Expand Down Expand Up @@ -745,8 +778,12 @@ void QgsSpit::import()
res = PQexec( pd, query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
qWarning( PQresultErrorMessage( res ) );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
QString err = PQresultErrorMessage( res );
qWarning( err );
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
"<p>Error while executing the SQL:</p><p>" +
query + "</p><p>The database said:" +
err + "</p>" );
}
else
{
Expand Down

0 comments on commit 11092eb

Please sign in to comment.