mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
PostgreSQL utility class (singleton). This is not used anywhere yet and is not complete.
git-svn-id: http://svn.osgeo.org/qgis/trunk@2308 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
b585756ab6
commit
e4ad28e8c5
@ -40,6 +40,14 @@ bool QgsPgUtil::isReserved(QString word)
|
|||||||
QStringList::iterator it = mReservedWords.find(word.upper());
|
QStringList::iterator it = mReservedWords.find(word.upper());
|
||||||
return (it != mReservedWords.end());
|
return (it != mReservedWords.end());
|
||||||
}
|
}
|
||||||
|
void QgsPgUtil::setConnection(PGconn *con)
|
||||||
|
{
|
||||||
|
mPgConnection = con;
|
||||||
|
}
|
||||||
|
PGconn *QgsPgUtil::connection()
|
||||||
|
{
|
||||||
|
return mPgConnection;
|
||||||
|
}
|
||||||
void QgsPgUtil::initReservedWords()
|
void QgsPgUtil::initReservedWords()
|
||||||
{
|
{
|
||||||
// create the reserved word list by loading
|
// create the reserved word list by loading
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
#define QGSPGUTIL_H
|
#define QGSPGUTIL_H
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include <libpq-fe.h>
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \class QgsPgUtil
|
* \class QgsPgUtil
|
||||||
* \brief Class containing utility functions for working with PostgreSQL
|
* \brief Class containing utility functions for working with PostgreSQL
|
||||||
@ -34,6 +39,16 @@ class QgsPgUtil
|
|||||||
* @return True if word is a PG reserved word
|
* @return True if word is a PG reserved word
|
||||||
*/
|
*/
|
||||||
bool isReserved(QString word);
|
bool isReserved(QString word);
|
||||||
|
/*!
|
||||||
|
* Set the connection to be used in database operations
|
||||||
|
* @param con Pointer to an active PostgreSQL connection
|
||||||
|
*/
|
||||||
|
void setConnection(PGconn *con);
|
||||||
|
/*!
|
||||||
|
* Get the connection currently in use for database operations
|
||||||
|
* @return Pointer to the PostgreSQL connection object
|
||||||
|
*/
|
||||||
|
PGconn *connection();
|
||||||
protected:
|
protected:
|
||||||
//! Protected constructor
|
//! Protected constructor
|
||||||
QgsPgUtil();
|
QgsPgUtil();
|
||||||
@ -46,5 +61,7 @@ class QgsPgUtil
|
|||||||
static QgsPgUtil* mInstance;
|
static QgsPgUtil* mInstance;
|
||||||
//! Reserved word list
|
//! Reserved word list
|
||||||
QStringList mReservedWords;
|
QStringList mReservedWords;
|
||||||
|
//! PostgreSQL connection
|
||||||
|
PGconn *mPgConnection;
|
||||||
};
|
};
|
||||||
#endif // QGSPGUTIL_H
|
#endif // QGSPGUTIL_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user