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:
gsherman 2004-11-22 07:08:04 +00:00
parent b585756ab6
commit e4ad28e8c5
2 changed files with 25 additions and 0 deletions

View File

@ -40,6 +40,14 @@ bool QgsPgUtil::isReserved(QString word)
QStringList::iterator it = mReservedWords.find(word.upper());
return (it != mReservedWords.end());
}
void QgsPgUtil::setConnection(PGconn *con)
{
mPgConnection = con;
}
PGconn *QgsPgUtil::connection()
{
return mPgConnection;
}
void QgsPgUtil::initReservedWords()
{
// create the reserved word list by loading

View File

@ -17,6 +17,11 @@
#define QGSPGUTIL_H
#include <map>
#include <qstringlist.h>
extern "C"
{
#include <libpq-fe.h>
}
/*!
* \class QgsPgUtil
* \brief Class containing utility functions for working with PostgreSQL
@ -34,6 +39,16 @@ class QgsPgUtil
* @return True if word is a PG reserved 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 constructor
QgsPgUtil();
@ -46,5 +61,7 @@ class QgsPgUtil
static QgsPgUtil* mInstance;
//! Reserved word list
QStringList mReservedWords;
//! PostgreSQL connection
PGconn *mPgConnection;
};
#endif // QGSPGUTIL_H