Debian Codegraph @

DatabaseExplorer/table.cpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : table.cpp
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 #include "table.h"
27
28 XS_IMPLEMENT_CLONABLE_CLASS(Table,xsSerializable);
29
30 Table::Table()
31 {
32 m_isView = false;
33
34 initSerializable();
35 }
36
37 Table::Table(const Table& obj): xsSerializable(obj)
38 {
39 this->m_name = obj.m_name;
40 this->m_parentName = obj.m_parentName;
41 this->m_rowCount = obj.m_rowCount;
42 this->m_isView = obj.m_isView;
43 //this->m_pDbAdapter = obj.m_pDbAdapter;
44
45 initSerializable();
46
47 }
48
49 Table::Table(IDbAdapter* dbAdapter, const wxString& tableName, const wxString& parentName, bool isView)
50 {
51 this->m_name = tableName;
52 this->m_parentName = parentName;
53 this->m_rowCount = 0;
54 this->m_pDbAdapter = dbAdapter;
55 this->m_isView = isView;
56
57 initSerializable();
58 }
59
60 Table::~Table()
61 {
62
63 }
64
65 void Table::SetName(const wxString& name)
66 {
67 this->m_isSaved = false;
68 this->m_name = name;
69 }
70
71 void Table::initSerializable()
72 {
73 XS_SERIALIZE(this->m_name,wxT("tableName"));
74 XS_SERIALIZE(this->m_parentName,wxT("parentName"));
75 XS_SERIALIZE_INT(this->m_rowCount, wxT("rowCount"));
76 XS_SERIALIZE(this->m_lstChildItems,wxT("columns"));
77 XS_SERIALIZE(this->m_isView, wxT("isView"));
78
79 }
80
81 void Table::RefreshChildren()
82 {
83 GetChildrenList().DeleteContents(true);
84 GetChildrenList().Clear();
85 if (m_pDbAdapter){
86 m_pDbAdapter->GetColumns(this);
87 }
88 }