Skip to content
Permalink
Browse files
Removed some autogenerated files
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 0a183c0a000c0f6b0e0c53721ead5076205e0b7e
Showing with 28 additions and 10 deletions.
  1. +0 −1 debian/libqgis1.substvars
  2. +0 −1 debian/qgis-plugin-grass.substvars
  3. +0 −1 debian/qgis.substvars
  4. +19 −2 src/core/qgsspatialrefsys.cpp
  5. +9 −5 tests/src/core/testqgsvectorfilewriter.cpp

This file was deleted.

This file was deleted.

This file was deleted.

@@ -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;
@@ -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);
@@ -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++)
@@ -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);

@@ -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);
@@ -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);
@@ -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;
}
};

0 comments on commit 0a183c0

Please sign in to comment.