Created IndexModel for displaying the indexes on a table. Constraints can now show the SQL to drop and create them.

The keyword list is now directly based of the official keyword list from postgresql.
This commit is contained in:
eelke 2018-01-06 21:22:22 +01:00
parent b436814eb5
commit 97d4e2a1a4
24 changed files with 754 additions and 228 deletions

51
pglablib/PgKeywordList.h Normal file
View file

@ -0,0 +1,51 @@
#ifndef PGKEYWORDLIST_H
#define PGKEYWORDLIST_H
#include <QString>
#include <unordered_set>
#include <functional>
#include "util.h"
#define UNRESERVED_KEYWORD 0
#define COL_NAME_KEYWORD 1
#define TYPE_FUNC_NAME_KEYWORD 2
#define RESERVED_KEYWORD 3
using t_SymbolSet = std::unordered_set<QString>;
class Keyword {
public:
Keyword(QString kw, int16_t cat)
: m_keyword(kw), m_category(cat)
{}
const QString& getKeyword() const { return m_keyword; }
int16_t getCategory() const { return m_category; }
//bool operator<(const QString &s) const { return m_keyword < s; }
bool operator<(const Keyword &kw) const { return m_keyword < kw.m_keyword; }
private:
QString m_keyword;
int16_t m_category;
};
namespace std {
template <>
struct hash<Keyword>
{
std::size_t operator()(const Keyword& s) const
{
return qHash(s.getKeyword());
}
};
}
const Keyword* getPgsqlKeyword(QString s);
#endif // PGKEYWORDLIST_H