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/branches/Release-0_8_0@6827 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 23, 2007
1 parent b50cead commit cb3584aa86f0018c1dbc03ea2b76ffecbb50cbe1
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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) <<
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;

0 comments on commit cb3584a

Please sign in to comment.