Skip to content

Commit 11092eb

Browse files
author
g_j_m
committedOct 16, 2006
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

File tree

1 file changed

+55
-18
lines changed

1 file changed

+55
-18
lines changed
 

‎src/plugins/spit/qgsspit.cpp

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,12 @@ void QgsSpit::import()
568568
rel_exists1 = ( PQntuples( res ) > 0 );
569569
if ( PQresultStatus( res ) != PGRES_TUPLES_OK )
570570
{
571-
qWarning( PQresultErrorMessage( res ) );
572-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
571+
QString err = PQresultErrorMessage( res );
572+
qWarning( err );
573+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
574+
"<p>Error while executing the SQL:</p><p>" +
575+
query + "</p><p>The database said:" +
576+
err + "</p>" );
573577
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
574578
continue;
575579
}
@@ -585,8 +589,13 @@ void QgsSpit::import()
585589
rel_exists2 = ( PQntuples( res ) > 0 );
586590
if ( PQresultStatus( res ) != PGRES_TUPLES_OK )
587591
{
588-
qWarning( PQresultErrorMessage( res ) );
589-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
592+
QString err = PQresultErrorMessage( res );
593+
qWarning( err );
594+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
595+
"<p>Error while executing the SQL:</p><p>" +
596+
query + "</p><p>The database said:" +
597+
err + "</p>" );
598+
590599
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
591600
continue;
592601
}
@@ -600,8 +609,12 @@ void QgsSpit::import()
600609
res = PQexec( pd, query );
601610
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
602611
{
603-
qWarning( PQresultErrorMessage( res ) );
604-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
612+
QString err = PQresultErrorMessage( res );
613+
qWarning( err );
614+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
615+
"<p>Error while executing the SQL:</p><p>" +
616+
query + "</p><p>The database said:" +
617+
err + "</p>" );
605618
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
606619
continue;
607620
}
@@ -619,9 +632,13 @@ void QgsSpit::import()
619632
qWarning( query );
620633
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
621634
{
622-
qWarning( PQresultErrorMessage( res ) );
635+
QString err = PQresultErrorMessage( res );
636+
qWarning( err );
623637
qWarning( PQresStatus( PQresultStatus( res ) ) );
624-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
638+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
639+
"<p>Error while executing the SQL:</p><p>" +
640+
query + "</p><p>The database said:" +
641+
err + "</p>" );
625642
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
626643
continue;
627644
}
@@ -655,8 +672,12 @@ void QgsSpit::import()
655672
res = PQexec( pd, ( const char * ) query );
656673
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
657674
{
658-
qWarning( PQresultErrorMessage( res ) );
659-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
675+
QString err = PQresultErrorMessage( res );
676+
qWarning( err );
677+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
678+
"<p>Error while executing the SQL:</p><p>" +
679+
query + "</p><p>The database said:" +
680+
err + "</p>" );
660681
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
661682
continue;
662683
}
@@ -676,8 +697,12 @@ void QgsSpit::import()
676697
res = PQexec( pd, ( const char * ) query );
677698
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
678699
{
679-
qWarning( PQresultErrorMessage( res ) );
680-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
700+
QString err = PQresultErrorMessage( res );
701+
qWarning( err );
702+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
703+
"<p>Error while executing the SQL:</p><p>" +
704+
query + "</p><p>The database said:" +
705+
err + "</p>" );
681706
pro.setValue( pro.value() + tblShapefiles->item( i, ColFEATURECOUNT )->text().toInt() );
682707
continue;
683708
}
@@ -693,8 +718,12 @@ void QgsSpit::import()
693718
res = PQexec( pd, query );
694719
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
695720
{
696-
qWarning( PQresultErrorMessage( res ) );
697-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
721+
QString err = PQresultErrorMessage( res );
722+
qWarning( err );
723+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
724+
"<p>Error while executing the SQL:</p><p>" +
725+
query + "</p><p>The database said:" +
726+
err + "</p>" );
698727
}
699728
else
700729
{
@@ -715,8 +744,12 @@ void QgsSpit::import()
715744
res = PQexec( pd, query );
716745
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
717746
{
718-
qWarning( PQresultErrorMessage( res ) );
719-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
747+
QString err = PQresultErrorMessage( res );
748+
qWarning( err );
749+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
750+
"<p>Error while executing the SQL:</p><p>" +
751+
query + "</p><p>The database said:" +
752+
err + "</p>" );
720753
continue;
721754
}
722755
else
@@ -745,8 +778,12 @@ void QgsSpit::import()
745778
res = PQexec( pd, query );
746779
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
747780
{
748-
qWarning( PQresultErrorMessage( res ) );
749-
QMessageBox::warning( &pro, tr("Import Shapefiles"), error );
781+
QString err = PQresultErrorMessage( res );
782+
qWarning( err );
783+
QMessageBox::warning( &pro, tr("Import Shapefiles"), error + "\n" +
784+
"<p>Error while executing the SQL:</p><p>" +
785+
query + "</p><p>The database said:" +
786+
err + "</p>" );
750787
}
751788
else
752789
{

0 commit comments

Comments
 (0)
Please sign in to comment.