| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2014 Eran Ifrah |
| 5 |
// file name : SqliteType.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 SQLITETYPE_H |
| 27 |
#define SQLITETYPE_H |
| 28 |
|
| 29 |
#include <wx/wxxmlserializer/XmlSerializer.h> |
| 30 |
#include "IDbType.h" // Base class: IDbType |
| 31 |
|
| 32 |
class SqliteType : public IDbType { |
| 33 |
|
| 34 |
public: |
| 35 |
XS_DECLARE_CLONABLE_CLASS(SqliteType); |
| 36 |
SqliteType(); |
| 37 |
SqliteType(const SqliteType& obj); |
| 38 |
SqliteType(const wxString& typeName, long propertyFlags, UNIVERSAL_TYPE universalType); |
| 39 |
virtual ~SqliteType(); |
| 40 |
void InitSerialize(); |
| 41 |
|
| 42 |
public: |
| 43 |
virtual bool GetAutoIncrement() { |
| 44 |
return false; |
| 45 |
} |
| 46 |
virtual bool GetNotNull() { |
| 47 |
return m_notNull; |
| 48 |
} |
| 49 |
virtual bool GetPrimaryKey() { |
| 50 |
return false; |
| 51 |
} |
| 52 |
virtual long GetPropertyFlags() { |
| 53 |
return m_dbtPropertyFlags; |
| 54 |
} |
| 55 |
virtual long GetSize() { |
| 56 |
return 0; |
| 57 |
} |
| 58 |
virtual long GetSize2() { |
| 59 |
return 0; |
| 60 |
} |
| 61 |
virtual wxString GetTypeName() { |
| 62 |
return m_typeName; |
| 63 |
} |
| 64 |
virtual bool GetUnique() { |
| 65 |
return false; |
| 66 |
} |
| 67 |
virtual bool HaveAutoIncrement() { |
| 68 |
return (m_dbtPropertyFlags & dbtAUTO_INCREMENT); |
| 69 |
} |
| 70 |
virtual bool HaveNotNull() { |
| 71 |
return (m_dbtPropertyFlags & dbtNOT_NULL); |
| 72 |
} |
| 73 |
virtual bool HavePrimaryKey() { |
| 74 |
return (m_dbtPropertyFlags & dbtPRIMARY_KEY); |
| 75 |
} |
| 76 |
virtual bool HaveSize() { |
| 77 |
return (m_dbtPropertyFlags & dbtSIZE); |
| 78 |
} |
| 79 |
virtual bool HaveSize2() { |
| 80 |
return (m_dbtPropertyFlags & dbtSIZE_TWO); |
| 81 |
} |
| 82 |
virtual bool HaveUnique() { |
| 83 |
return (m_dbtPropertyFlags & dbtUNIQUE); |
| 84 |
} |
| 85 |
virtual void SetAutoIncrement(bool autoIncrement) { |
| 86 |
m_autoIncrement = autoIncrement; |
| 87 |
} |
| 88 |
virtual void SetNotNull(bool notNull) { |
| 89 |
m_notNull = notNull; |
| 90 |
} |
| 91 |
virtual void SetPrimaryKey(bool primaryKey) { |
| 92 |
m_primaryKey = primaryKey; |
| 93 |
} |
| 94 |
virtual void SetSize(long size) { |
| 95 |
m_size = size; |
| 96 |
} |
| 97 |
virtual void SetSize2(long size) { |
| 98 |
m_size2 = size; |
| 99 |
} |
| 100 |
virtual void SetUnique(bool unique) { |
| 101 |
m_unique = unique; |
| 102 |
} |
| 103 |
|
| 104 |
virtual void SetPropertyFlags(long flags) { |
| 105 |
m_dbtPropertyFlags = flags; |
| 106 |
} |
| 107 |
|
| 108 |
virtual wxString ReturnSql(); |
| 109 |
|
| 110 |
|
| 111 |
virtual IDbType::UNIVERSAL_TYPE GetUniversalType(); |
| 112 |
|
| 113 |
|
| 114 |
protected: |
| 115 |
|
| 116 |
wxString m_typeName; |
| 117 |
long m_dbtPropertyFlags; |
| 118 |
long m_universalType; |
| 119 |
|
| 120 |
long m_size; |
| 121 |
long m_size2; |
| 122 |
bool m_unique; |
| 123 |
bool m_primaryKey; |
| 124 |
bool m_notNull; |
| 125 |
bool m_autoIncrement; |
| 126 |
}; |
| 127 |
|
| 128 |
#endif // SQLITETYPE_H |