~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/gui/qgspgutil.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                qgspgutil.cpp - PostgreSQL Utility Functions
3
 
                     --------------------------------------
4
 
               Date                 : 2004-11-21
5
 
               Copyright            : (C) 2004 by Gary E.Sherman
6
 
               Email                : sherman at mrcc.com
7
 
 ***************************************************************************
8
 
 *                                                                         *
9
 
 *   This program is free software; you can redistribute it and/or modify  *
10
 
 *   it under the terms of the GNU General Public License as published by  *
11
 
 *   the Free Software Foundation; either version 2 of the License, or     *
12
 
 *   (at your option) any later version.                                   *
13
 
 *                                                                         *
14
 
 ***************************************************************************/
15
 
/* $Id: qgspgutil.cpp 4619 2006-01-08 23:18:32Z timlinux $ */
16
 
#include "qgspgutil.h"
17
 
 
18
 
QgsPgUtil *QgsPgUtil::mInstance = 0;
19
 
QgsPgUtil * QgsPgUtil::instance()
20
 
{
21
 
  if(mInstance == 0)
22
 
  {
23
 
    mInstance = new QgsPgUtil();
24
 
  }
25
 
  return mInstance;
26
 
}
27
 
QgsPgUtil::QgsPgUtil()
28
 
{
29
 
  // load the reserved word map
30
 
  initReservedWords();
31
 
}
32
 
QgsPgUtil::~QgsPgUtil()
33
 
{
34
 
}
35
 
bool QgsPgUtil::isReserved(QString word)
36
 
{
37
 
  // uppercase the word before testing it since all our reserved words are
38
 
  // stored in uppercase
39
 
  
40
 
  QStringList::iterator it = mReservedWords.find(word.upper());
41
 
  return (it != mReservedWords.end());
42
 
}
43
 
void QgsPgUtil::setConnection(PGconn *con)
44
 
{
45
 
  mPgConnection = con;
46
 
}
47
 
PGconn *QgsPgUtil::connection()
48
 
{
49
 
  return mPgConnection;
50
 
}
51
 
const QStringList & QgsPgUtil::reservedWords()
52
 
{
53
 
  return mReservedWords;
54
 
}
55
 
void QgsPgUtil::initReservedWords()
56
 
{
57
 
  // create the reserved word list by loading
58
 
  // the words into a QStringList. We code them here
59
 
  // for now rather than deal with the complexities
60
 
  // of finding and loading from a text file
61
 
  // in the install path
62
 
  mReservedWords << "ALL"
63
 
    << "ANALYSE"
64
 
    << "ANALYZE"
65
 
    << "AND"
66
 
    << "ANY"
67
 
    << "ARRAY"
68
 
    << "AS"
69
 
    << "ASC"
70
 
    << "AUTHORIZATION"
71
 
    << "BETWEEN"
72
 
    << "BINARY"
73
 
    << "BOTH"
74
 
    << "CASE"
75
 
    << "CAST"
76
 
    << "CHECK"
77
 
    << "COLLATE"
78
 
    << "COLUMN"
79
 
    << "CONSTRAINT"
80
 
    << "CREATE"
81
 
    << "CROSS"
82
 
    << "CURRENT_DATE"
83
 
    << "CURRENT_TIME"
84
 
    << "CURRENT_TIMESTAMP"
85
 
    << "CURRENT_USER"
86
 
    << "DEFAULT"
87
 
    << "DEFERRABLE"
88
 
    << "DESC"
89
 
    << "DISTINCT"
90
 
    << "DO"
91
 
    << "ELSE"
92
 
    << "END"
93
 
    << "EXCEPT"
94
 
    << "FALSE"
95
 
    << "FOR"
96
 
    << "FOREIGN"
97
 
    << "FREEZE"
98
 
    << "FROM"
99
 
    << "FULL"
100
 
    << "GRANT"
101
 
    << "GROUP"
102
 
    << "HAVING"
103
 
    << "ILIKE"
104
 
    << "IN"
105
 
    << "INITIALLY"
106
 
    << "INNER"
107
 
    << "INTERSECT"
108
 
    << "INTO"
109
 
    << "IS"
110
 
    << "ISNULL"
111
 
    << "JOIN"
112
 
    << "LEADING"
113
 
    << "LEFT"
114
 
    << "LIKE"
115
 
    << "LIMIT"
116
 
    << "LOCALTIME"
117
 
    << "LOCALTIMESTAMP"
118
 
    << "NAMES"
119
 
    << "NATURAL"
120
 
    << "NEW"
121
 
    << "NOT"
122
 
    << "NOTNULL"
123
 
    << "NULL"
124
 
    << "OFF"
125
 
    << "OFFSET"
126
 
    << "OLD"
127
 
    << "ON"
128
 
    << "ONLY"
129
 
    << "OR"
130
 
    << "ORDER"
131
 
    << "OUTER"
132
 
    << "OVERLAPS"
133
 
    << "PLACING"
134
 
    << "PRIMARY"
135
 
    << "REFERENCES"
136
 
    << "RIGHT"
137
 
    << "SELECT"
138
 
    << "SESSION_USER"
139
 
    << "SIMILAR"
140
 
    << "SOME"
141
 
    << "TABLE"
142
 
    << "THEN"
143
 
    << "TO"
144
 
    << "TRAILING"
145
 
    << "TRUE"
146
 
    << "UNION"
147
 
    << "UNIQUE"
148
 
    << "USER"
149
 
    << "USING"
150
 
    << "VERBOSE"
151
 
    << "WHEN"
152
 
    << "WHERE";
153
 
}