Skip to content

Commit 3d72f7e

Browse files
author
timlinux
committedSep 13, 2007

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed
 

‎debian/libqgis1.substvars

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎debian/qgis-plugin-grass.substvars

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎debian/qgis.substvars

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/core/qgsspatialrefsys.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ bool QgsSpatialRefSys::createFromSrid(long theSrid)
189189
// Get the full path name to the sqlite3 spatial reference database.
190190
QString myDatabaseFileName = QgsApplication::srsDbFilePath();
191191

192+
QFileInfo myInfo (myDatabaseFileName);
193+
if (!myInfo.exists())
194+
{
195+
QgsDebugMsg("QgsSpatialRefSys::createFromSrid failed : " + myDatabaseFileName +
196+
" does not exist!");
197+
return false;
198+
}
199+
192200

193201
sqlite3 *myDatabase;
194202
const char *myTail;
@@ -582,6 +590,13 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
582590
QgsDebugMsg("QgsSpatialRefSys::getRecord...running query: " + theSql);
583591
// Get the full path name to the sqlite3 spatial reference database.
584592
myDatabaseFileName = QgsApplication::srsDbFilePath();
593+
QFileInfo myInfo (myDatabaseFileName);
594+
if (!myInfo.exists())
595+
{
596+
QgsDebugMsg("QgsSpatialRefSys::createFromSrid failed : " + myDatabaseFileName +
597+
" does not exist!");
598+
return myMap;
599+
}
585600

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

@@ -924,7 +940,8 @@ long QgsSpatialRefSys::findMatchingProj()
924940
}
925941
}
926942
}
927-
//std::cout << "QgsSpatialRefSys::findMatchingProj -------> no match found in srs.db, trying user db now!" << std::endl;
943+
QgsLogger::warning("QgsSpatialRefSys::findMatchingProj ------->"
944+
"\n no match found in srs.db, trying user db now!");
928945
// close the sqlite3 statement
929946
sqlite3_finalize(myPreparedStatement);
930947
sqlite3_close(myDatabase);

‎tests/src/core/testqgsvectorfilewriter.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class TestQgsVectorFileWriter: public QObject
2323
private slots:
2424
void createVectorFile()
2525
{
26+
qDebug("\n\n **************\n"
27+
"Note: if you get a message like \n"
28+
"ERROR 1: /tmp/testshp.shp is not a directory.\n"
29+
"It is caused by the /tmp/testshp.* files already existing\n"
30+
"(the ERROR comes from OGR and is not very intuitive)\n"
31+
"******************\n");
2632
// init QGIS's paths - true means that all path will be inited from prefix
2733
QString qgisPath = QCoreApplication::applicationDirPath ();
2834
QgsApplication::setPrefixPath(qgisPath, TRUE);
@@ -75,24 +81,22 @@ class TestQgsVectorFileWriter: public QObject
7581
//
7682
// Write the featyre to the filewriter
7783
//
78-
myWriter.addFeature(myFeature);
84+
QVERIFY(myWriter.addFeature(myFeature));
7985
myError = myWriter.hasError();
8086
if(myError==QgsVectorFileWriter::ErrDriverNotFound)
8187
{
8288
std::cout << "Driver not found error" << std::endl;
8389
}
84-
85-
if (myError==QgsVectorFileWriter::ErrCreateDataSource)
90+
else if (myError==QgsVectorFileWriter::ErrCreateDataSource)
8691
{
8792
std::cout << "Create data source error" << std::endl;
8893
}
89-
if (myError==QgsVectorFileWriter::ErrCreateLayer)
94+
else if (myError==QgsVectorFileWriter::ErrCreateLayer)
9095
{
9196
std::cout << "Create layer error" << std::endl;
9297
}
9398
QVERIFY(myError==QgsVectorFileWriter::NoError);
9499
// other possible outcomes...
95-
delete mypGeometry;
96100
}
97101
};
98102

0 commit comments

Comments
 (0)
Please sign in to comment.