Skip to content

Commit

Permalink
sqlite3_open() MUST have db name in Utf-8. Fixes #676.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6828 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 23, 2007
1 parent dfafc41 commit 4589ddb
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsbookmarkitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions src/app/qgscustomprojectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) <<
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsdistancearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsspatialrefsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 8 additions & 8 deletions src/gui/qgsprojectionselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/helpviewer/qgshelpviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4589ddb

Please sign in to comment.