Skip to content
Permalink
Browse files
sqlite3_open() MUST have db name in Utf-8. Fixes #676.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6828 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 23, 2007
1 parent 74edc8c commit c09e954c722fc504bc2d0e1bab8a323ec715dc8b
@@ -45,7 +45,7 @@ QgsBookmarkItem::~QgsBookmarkItem()
#ifdef QGISDEBUG
std::cout << "Opening user database: " << mUserDbPath.toLocal8Bit().data() << std::endl;
#endif
rc = sqlite3_open(mUserDbPath.toLocal8Bit().data(), &db);
rc = sqlite3_open(mUserDbPath.toUtf8().data(), &db);
if(rc)
{
std::cout << "Can't open database: " << sqlite3_errmsg(db) << std::endl;
@@ -216,7 +216,7 @@ int QgsBookmarks::connectDb()
{

int rc;
rc = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &db);
rc = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &db);
if(rc)
{
std::cout << "Can't open database: " << sqlite3_errmsg(db) << std::endl;
@@ -89,7 +89,7 @@ void QgsCustomProjectionDialog::getProjList ()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -124,7 +124,7 @@ void QgsCustomProjectionDialog::getEllipsoidList()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -168,7 +168,7 @@ void QgsCustomProjectionDialog::on_pbnDelete_clicked()
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -228,7 +228,7 @@ long QgsCustomProjectionDialog::getRecordCount()
int myResult;
long myRecordCount=0;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -263,7 +263,7 @@ QString QgsCustomProjectionDialog::getProjectionFamilyName(QString theProjection
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -294,7 +294,7 @@ QString QgsCustomProjectionDialog::getEllipsoidName(QString theEllipsoidAcronym)
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -325,7 +325,7 @@ QString QgsCustomProjectionDialog::getProjectionFamilyAcronym(QString theProject
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -356,7 +356,7 @@ QString QgsCustomProjectionDialog::getEllipsoidAcronym(QString theEllipsoidName)
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -390,7 +390,7 @@ void QgsCustomProjectionDialog::on_pbnFirst_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -468,7 +468,7 @@ void QgsCustomProjectionDialog::on_pbnPrevious_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -547,7 +547,7 @@ void QgsCustomProjectionDialog::on_pbnNext_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -623,7 +623,7 @@ void QgsCustomProjectionDialog::on_pbnLast_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -842,7 +842,7 @@ void QgsCustomProjectionDialog::on_pbnSave_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) <<
@@ -970,7 +970,7 @@ void QgsCustomProjectionDialog::cboProjectionFamily_highlighted( const QString &
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -337,7 +337,7 @@ void QgsOptions::getEllipsoidList()

cmbEllipsoid->insertItem(ELLIPS_FLAT_DESC);
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -370,7 +370,7 @@ QString QgsOptions::getEllipsoidAcronym(QString theEllipsoidName)
int myResult;
QString myName(ELLIPS_FLAT);
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -402,7 +402,7 @@ QString QgsOptions::getEllipsoidName(QString theEllipsoidAcronym)
int myResult;
QString myName(ELLIPS_FLAT_DESC);
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -87,7 +87,7 @@ bool QgsDistanceArea::setEllipsoid(const QString& ellipsoid)
}

//check the db is available
myResult = sqlite3_open(QString(QgsApplication::qgisUserDbFilePath()).latin1(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -1261,7 +1261,7 @@ QString::number(USER_PROJECTION_START_ID));
int QgsSpatialRefSys::openDb(QString path, sqlite3 **db)
{
QgsDebugMsg("QgsSpatialRefSys::openDb path = " + path);
int myResult = sqlite3_open(path.toLocal8Bit().data(), db);
int myResult = sqlite3_open(path.toUtf8().data(), db);

if(myResult)
{
@@ -302,7 +302,7 @@ QString QgsProjectionSelector::getCurrentProj4String()

sqlite3 *db;
int rc;
rc = sqlite3_open(myDatabaseFileName.toLocal8Bit().data(), &db);
rc = sqlite3_open(myDatabaseFileName.toUtf8().data(), &db);
if(rc)
{
QgsLogger::warning("Can't open database: " + QString(sqlite3_errmsg(db)));
@@ -394,7 +394,7 @@ long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
// opening it each time seems to be a reasonable approach at this time.
sqlite3 *db;
int rc;
rc = sqlite3_open(myDatabaseFileName.toLocal8Bit().data(), &db);
rc = sqlite3_open(myDatabaseFileName.toUtf8().data(), &db);
if(rc)
{
std::cout << "Can't open database: " << sqlite3_errmsg(db) << std::endl;
@@ -515,7 +515,7 @@ void QgsProjectionSelector::applyUserProjList(QSet<QString> * crsFilter)
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QString(myDatabaseFileName).toLocal8Bit().data(), &myDatabase);
myResult = sqlite3_open(QString(myDatabaseFileName).toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -591,7 +591,7 @@ void QgsProjectionSelector::applyProjList(QSet<QString> * crsFilter)
// open the database containing the spatial reference data
sqlite3 *db;
int rc;
rc = sqlite3_open(mSrsDatabaseFileName.toLocal8Bit().data(), &db);
rc = sqlite3_open(mSrsDatabaseFileName.toUtf8().data(), &db);
if(rc)
{
std::cout << "Can't open database: " << sqlite3_errmsg(db) << std::endl;
@@ -861,7 +861,7 @@ void QgsProjectionSelector::on_pbnFind_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(mSrsDatabaseFileName.toLocal8Bit().data(), &myDatabase);
myResult = sqlite3_open(mSrsDatabaseFileName.toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -897,7 +897,7 @@ void QgsProjectionSelector::on_pbnFind_clicked()
qDebug("User db does not exist");
return ;
}
myResult = sqlite3_open(myDatabaseFileName.toLocal8Bit().data(), &myDatabase);
myResult = sqlite3_open(myDatabaseFileName.toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open * user * database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -941,7 +941,7 @@ long QgsProjectionSelector::getLargestSRSIDMatch(QString theSql)
myFileInfo.setFile(myDatabaseFileName);
if ( myFileInfo.exists( ) ) //only bother trying to open if the file exists
{
myResult = sqlite3_open(myDatabaseFileName.toLocal8Bit().data(), &myDatabase);
myResult = sqlite3_open(myDatabaseFileName.toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -973,7 +973,7 @@ long QgsProjectionSelector::getLargestSRSIDMatch(QString theSql)

//only bother looking in srs.db if it wasnt found above

myResult = sqlite3_open(mSrsDatabaseFileName.toLocal8Bit().data(), &myDatabase);
myResult = sqlite3_open(mSrsDatabaseFileName.toUtf8().data(), &myDatabase);
if(myResult)
{
std::cout << "Can't open * user * database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -188,7 +188,7 @@ int QgsHelpViewer::connectDb(const QString &helpDbPath)
int result;
if(QFileInfo(helpDbPath).exists()){
int rc;
rc = sqlite3_open(helpDbPath, &db);
rc = sqlite3_open(helpDbPath.toUtf8().data(), &db);
result = rc;
}
else

0 comments on commit c09e954

Please sign in to comment.