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/branches/Release-0_8_0@6827 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 23, 2007
1 parent b50cead commit cb3584a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/core/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/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/gui/qgsbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,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/gui/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 @@ -261,7 +261,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 @@ -292,7 +292,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 @@ -323,7 +323,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 @@ -354,7 +354,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 @@ -388,7 +388,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 @@ -464,7 +464,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 @@ -541,7 +541,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 @@ -615,7 +615,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 @@ -832,7 +832,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 @@ -960,7 +960,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/gui/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void QgsOptions::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 @@ -348,7 +348,7 @@ QString QgsOptions::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 @@ -380,7 +380,7 @@ QString QgsOptions::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
2 changes: 1 addition & 1 deletion src/helpviewer/qgshelpviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int QgsHelpViewer::connectDb(const QString &helpDbPath)
if(QFileInfo(helpDbPath).exists()){
char *zErrMsg = 0;
int rc;
rc = sqlite3_open(helpDbPath, &db);
rc = sqlite3_open(helpDbPath.toUtf8().data(), &db);
result = rc;
}
else
Expand Down
16 changes: 8 additions & 8 deletions src/widgets/projectionselector/qgsprojectionselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ QString QgsProjectionSelector::getCurrentProj4String()

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 @@ -400,7 +400,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 @@ -521,7 +521,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 @@ -597,7 +597,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 @@ -867,7 +867,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 @@ -903,7 +903,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 @@ -947,7 +947,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 @@ -983,7 +983,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

0 comments on commit cb3584a

Please sign in to comment.