12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- namespace OTSSQLITE
- {
- class ColumnType
- {
- public:
- enum class ID
- {
- MIN = 0,
- INT = 0,
- FLOAT = 1,
- STRING = 2,
- BLOB = 3,
- NONE = 4,
- MAX = 4
- };
- public:
- ColumnType(const ID a_nTypeId,
- const BOOL a_bIsPrimaryKey = FALSE,
- const BOOL a_bIsNotNull = FALSE,
- const BOOL a_bIsUnique = FALSE)
- : m_nTypeId(a_nTypeId)
- , m_bIsPrimaryKey(a_bIsPrimaryKey)
- , m_bIsNotNull(a_bIsNotNull)
- , m_bIsUnique(a_bIsUnique)
- {
- }
- ~ColumnType()
- {}
- ID GetTypeId() const { return m_nTypeId; }
- BOOL IsPrimaryKey() const { return m_bIsPrimaryKey; }
- BOOL IsIsNotNull() const { return m_bIsNotNull; }
- BOOL IsIsUnique() const { return m_bIsUnique; }
- static CString GetName(const int a_nId);
- static CString GetName(const ColumnType a_type);
- static CString GetFormat(const int a_nId);
- static CString GetFormat(const ColumnType a_type);
- static const CString PrimaryKeyString() { return m_sPrimaryKeyString; }
- static const CString NotNullString() { return m_sNotNullString; }
- static const CString UniqueString() { return m_sUniqueString; }
- protected:
- const ID m_nTypeId;
- const BOOL m_bIsPrimaryKey;
- const BOOL m_bIsNotNull;
- const BOOL m_bIsUnique;
- static const CString m_sPrimaryKeyString;
- static const CString m_sNotNullString;
- static const CString m_sUniqueString;
- static const CString m_strNames[(int)ID::MAX - (int)ID::MIN + 1];
- };
- typedef std::pair<CString, ColumnType> ColumnDefine;
- }
|