Skip to content
Permalink
Browse files
fix qml support for non-file data sources
git-svn-id: http://svn.osgeo.org/qgis/trunk@9019 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 7, 2008
1 parent c2d3a88 commit 23bf2a39356de2af40749ba2b54ae012a717a0cc
Showing with 29 additions and 33 deletions.
  1. +1 −1 src/app/qgsbookmarks.cpp
  2. +26 −30 src/app/qgscustomprojectiondialog.cpp
  3. +2 −2 src/core/qgsmaplayer.cpp
@@ -251,7 +251,7 @@ int QgsBookmarks::connectDb()

int rc;
rc = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &db);
if(rc)
if(rc!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(db) << std::endl;

@@ -105,14 +105,13 @@ void QgsCustomProjectionDialog::getProjList ()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the PROJECTION list
QString mySql = "select * from tbl_projection order by name";
myResult = sqlite3_prepare(myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail);
@@ -140,14 +139,13 @@ void QgsCustomProjectionDialog::getEllipsoidList()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select * from tbl_ellipsoid order by name";
myResult = sqlite3_prepare(myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail);
@@ -184,12 +182,12 @@ void QgsCustomProjectionDialog::on_pbnDelete_clicked()
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "delete from tbl_srs where srs_id='" + mCurrentRecordId + "'";
@@ -244,12 +242,12 @@ long QgsCustomProjectionDialog::getRecordCount()
long myRecordCount=0;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select count(*) from tbl_srs";
@@ -279,12 +277,12 @@ QString QgsCustomProjectionDialog::getProjectionFamilyName(QString theProjection
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select name from tbl_projection where acronym='" + theProjectionFamilyAcronym + "'";
@@ -310,12 +308,12 @@ QString QgsCustomProjectionDialog::getEllipsoidName(QString theEllipsoidAcronym)
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select name from tbl_ellipsoid where acronym='" + theEllipsoidAcronym + "'";
@@ -341,12 +339,12 @@ QString QgsCustomProjectionDialog::getProjectionFamilyAcronym(QString theProject
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select acronym from tbl_projection where name='" + theProjectionFamilyName + "'";
@@ -372,12 +370,12 @@ QString QgsCustomProjectionDialog::getEllipsoidAcronym(QString theEllipsoidName)
QString myName;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select acronym from tbl_ellipsoid where name='" + theEllipsoidName + "'";
@@ -406,12 +404,12 @@ void QgsCustomProjectionDialog::on_pbnFirst_clicked()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}

QString mySql = "select * from tbl_srs order by srs_id limit 1";
@@ -484,12 +482,12 @@ void QgsCustomProjectionDialog::on_pbnPrevious_clicked()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}

QString mySql = "select * from tbl_srs where srs_id < " + mCurrentRecordId + " order by srs_id desc limit 1";
@@ -563,15 +561,14 @@ void QgsCustomProjectionDialog::on_pbnNext_clicked()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}


QString mySql = "select * from tbl_srs where srs_id > " + mCurrentRecordId + " order by srs_id asc limit 1";
#ifdef QGISDEBUG
std::cout << "Query to move next:" << mySql.toLocal8Bit().data() << std::endl;
@@ -639,12 +636,12 @@ void QgsCustomProjectionDialog::on_pbnLast_clicked()
int myResult;
//check the db is available
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase);
if(myResult)
if(myResult!=SQLITE_OK)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}

QString mySql = "select * from tbl_srs order by srs_id desc limit 1";
@@ -868,7 +865,7 @@ void QgsCustomProjectionDialog::on_pbnSave_clicked()
<< std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
#ifdef QGISDEBUG
std::cout << "Update or insert sql \n" << mySql.toLocal8Bit().data() << std::endl;
@@ -993,9 +990,8 @@ void QgsCustomProjectionDialog::cboProjectionFamily_highlighted( const QString &
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
assert(myResult == 0);
assert(myResult == SQLITE_OK);
}
// Set up the query to retrieve the projection information needed to populate the PROJECTION list
QString mySql = "select parameters from tbl_projection name where name='"+theText+"'";
#ifdef QGISDEBUG
@@ -434,7 +434,7 @@ bool QgsMapLayer::loadNamedStyleFromDb (const QString db, const QString theURI,
QgsDebugMsg( QString("Trying to load style for \"%1\" from \"%2\"").arg(theURI).arg(db) );

myResult = sqlite3_open(db.toUtf8().data(), &myDatabase);
if (!myResult)
if (myResult!=SQLITE_OK)
{
return false;
}
@@ -610,7 +610,7 @@ QString QgsMapLayer::saveNamedStyle ( const QString theURI, bool & theResultFlag
int myResult;

myResult = sqlite3_open( QDir( QgsApplication::qgisSettingsDirPath() ).absoluteFilePath( "qgis.qmldb").toUtf8().data(), &myDatabase);
if (myResult)
if (myResult!=SQLITE_OK)
{
return tr("User database could not be opened.");
}

0 comments on commit 23bf2a3

Please sign in to comment.