Skip to content

Commit

Permalink
Removed some autogenerated files
Browse files Browse the repository at this point in the history
Added some extra tests for db existance in srs class



git-svn-id: http://svn.osgeo.org/qgis/trunk@7194 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Sep 13, 2007
1 parent 93e45f0 commit 0a183c0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
1 change: 0 additions & 1 deletion debian/libqgis1.substvars

This file was deleted.

1 change: 0 additions & 1 deletion debian/qgis-plugin-grass.substvars

This file was deleted.

1 change: 0 additions & 1 deletion debian/qgis.substvars

This file was deleted.

21 changes: 19 additions & 2 deletions src/core/qgsspatialrefsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ bool QgsSpatialRefSys::createFromSrid(long theSrid)
// Get the full path name to the sqlite3 spatial reference database.
QString myDatabaseFileName = QgsApplication::srsDbFilePath();

QFileInfo myInfo (myDatabaseFileName);
if (!myInfo.exists())
{
QgsDebugMsg("QgsSpatialRefSys::createFromSrid failed : " + myDatabaseFileName +
" does not exist!");
return false;
}


sqlite3 *myDatabase;
const char *myTail;
Expand Down Expand Up @@ -582,6 +590,13 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
QgsDebugMsg("QgsSpatialRefSys::getRecord...running query: " + theSql);
// Get the full path name to the sqlite3 spatial reference database.
myDatabaseFileName = QgsApplication::srsDbFilePath();
QFileInfo myInfo (myDatabaseFileName);
if (!myInfo.exists())
{
QgsDebugMsg("QgsSpatialRefSys::createFromSrid failed : " + myDatabaseFileName +
" does not exist!");
return myMap;
}

//check the db is available
myResult = openDb(myDatabaseFileName, &myDatabase);
Expand All @@ -594,6 +609,7 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK && sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
QgsDebugMsg("QgsSpatialRefSys::getRecord...trying system srs.db");
int myColumnCount = sqlite3_column_count(myPreparedStatement);
//loop through each column in the record adding its field name and vvalue to the map
for (int myColNo=0;myColNo < myColumnCount;myColNo++)
Expand All @@ -605,7 +621,7 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
}
else
{
QgsDebugMsg("QgsSpatialRefSys::getRecord...trying system users.db");
QgsDebugMsg("QgsSpatialRefSys::getRecord...trying system qgis.db");
sqlite3_finalize(myPreparedStatement);
sqlite3_close(myDatabase);

Expand Down Expand Up @@ -924,7 +940,8 @@ long QgsSpatialRefSys::findMatchingProj()
}
}
}
//std::cout << "QgsSpatialRefSys::findMatchingProj -------> no match found in srs.db, trying user db now!" << std::endl;
QgsLogger::warning("QgsSpatialRefSys::findMatchingProj ------->"
"\n no match found in srs.db, trying user db now!");
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
sqlite3_close(myDatabase);
Expand Down
14 changes: 9 additions & 5 deletions tests/src/core/testqgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class TestQgsVectorFileWriter: public QObject
private slots:
void createVectorFile()
{
qDebug("\n\n **************\n"
"Note: if you get a message like \n"
"ERROR 1: /tmp/testshp.shp is not a directory.\n"
"It is caused by the /tmp/testshp.* files already existing\n"
"(the ERROR comes from OGR and is not very intuitive)\n"
"******************\n");
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath ();
QgsApplication::setPrefixPath(qgisPath, TRUE);
Expand Down Expand Up @@ -75,24 +81,22 @@ class TestQgsVectorFileWriter: public QObject
//
// Write the featyre to the filewriter
//
myWriter.addFeature(myFeature);
QVERIFY(myWriter.addFeature(myFeature));
myError = myWriter.hasError();
if(myError==QgsVectorFileWriter::ErrDriverNotFound)
{
std::cout << "Driver not found error" << std::endl;
}

if (myError==QgsVectorFileWriter::ErrCreateDataSource)
else if (myError==QgsVectorFileWriter::ErrCreateDataSource)
{
std::cout << "Create data source error" << std::endl;
}
if (myError==QgsVectorFileWriter::ErrCreateLayer)
else if (myError==QgsVectorFileWriter::ErrCreateLayer)
{
std::cout << "Create layer error" << std::endl;
}
QVERIFY(myError==QgsVectorFileWriter::NoError);
// other possible outcomes...
delete mypGeometry;
}
};

Expand Down

0 comments on commit 0a183c0

Please sign in to comment.