Debian Codegraph @

DatabaseExplorer/PostgreSqlType.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : PostgreSqlType.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef POSTGRESQLTYPE_H
27 #define POSTGRESQLTYPE_H
28
29 #include <wx/wxxmlserializer/XmlSerializer.h>
30 #include "IDbType.h" // Base class: IDbType
31
32 class PostgreSqlType : public IDbType {
33
34 public:
35 XS_DECLARE_CLONABLE_CLASS(PostgreSqlType);
36 PostgreSqlType();
37 PostgreSqlType(const PostgreSqlType& obj);
38 PostgreSqlType(const wxString& typeName, long propertyFlags, UNIVERSAL_TYPE universalType);
39 virtual ~PostgreSqlType();
40 void InitSerialize();
41
42 virtual bool GetAutoIncrement() {
43 return m_autoIncrement;
44 }
45 virtual bool GetNotNull() {
46 return m_notNull;
47 }
48 virtual bool GetPrimaryKey() {
49 return m_primaryKey;
50 }
51 virtual long GetSize() {
52 return m_size;
53 }
54 virtual long GetSize2() {
55 return m_size2;
56 }
57 virtual wxString GetTypeName() {
58 return m_typeName;
59 }
60 virtual bool GetUnique() {
61 return m_unique;
62 }
63 virtual bool HaveAutoIncrement() {
64 return (m_dbtPropertyFlags & dbtAUTO_INCREMENT);
65 }
66 virtual bool HaveNotNull() {
67 return (m_dbtPropertyFlags & dbtNOT_NULL);
68 }
69 virtual bool HavePrimaryKey() {
70 return (m_dbtPropertyFlags & dbtPRIMARY_KEY);
71 }
72 virtual bool HaveSize() {
73 return (m_dbtPropertyFlags & dbtSIZE);
74 }
75 virtual bool HaveSize2() {
76 return (m_dbtPropertyFlags & dbtSIZE_TWO);
77 }
78 virtual bool HaveUnique() {
79 return (m_dbtPropertyFlags & dbtUNIQUE);
80 }
81 virtual void SetAutoIncrement(bool autoIncrement) {
82 m_autoIncrement = autoIncrement;
83 }
84 virtual void SetNotNull(bool notNull) {
85 m_notNull = notNull;
86 }
87 virtual void SetPrimaryKey(bool primaryKey) {
88 m_primaryKey = primaryKey;
89 }
90 virtual void SetSize(long size) {
91 m_size = size;
92 }
93 virtual void SetSize2(long size) {
94 m_size2 = size;
95 }
96 virtual void SetUnique(bool unique) {
97 m_unique = unique;
98 }
99 virtual wxString ReturnSql();
100
101 virtual long GetPropertyFlags() {
102 return m_dbtPropertyFlags;
103 }
104 virtual void SetPropertyFlags(long flags) {
105 m_dbtPropertyFlags = flags;
106 }
107
108
109 virtual IDbType::UNIVERSAL_TYPE GetUniversalType();
110
111
112 protected:
113 wxString m_typeName;
114 long m_dbtPropertyFlags;
115 long m_universalType;
116
117 long m_size;
118 long m_size2;
119 bool m_unique;
120 bool m_primaryKey;
121 bool m_notNull;
122 bool m_autoIncrement;
123
124 };
125
126 #endif // POSTGRESQLTYPE_H