| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2014 Eran Ifrah |
| 5 |
// file name : constraint.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 "constraint.h" |
| 27 |
XS_IMPLEMENT_CLONABLE_CLASS(Constraint,xsSerializable); |
| 28 |
Constraint::Constraint() |
| 29 |
{ |
| 30 |
m_type = foreignKey; |
| 31 |
m_onDelete = restrict; |
| 32 |
m_onUpdate = restrict; |
| 33 |
InitSerializable(); |
| 34 |
} |
| 35 |
Constraint::Constraint(const Constraint& obj):xsSerializable(obj) |
| 36 |
{ |
| 37 |
m_name = obj.m_name; |
| 38 |
m_localColumn = obj.m_localColumn; |
| 39 |
m_type = obj.m_type; |
| 40 |
m_refTable = obj.m_refTable; |
| 41 |
m_refCol = obj.m_refCol; |
| 42 |
m_onDelete = obj.m_onDelete; |
| 43 |
m_onUpdate = obj.m_onUpdate; |
| 44 |
InitSerializable(); |
| 45 |
|
| 46 |
} |
| 47 |
Constraint::Constraint(const wxString& name, const wxString& localColumn, constraintType type, constraintAction onDelete, constraintAction onUpdate) |
| 48 |
{ |
| 49 |
m_name = name; |
| 50 |
m_localColumn = localColumn; |
| 51 |
m_type = type; |
| 52 |
m_onDelete = onDelete; |
| 53 |
m_onUpdate = onUpdate; |
| 54 |
InitSerializable(); |
| 55 |
} |
| 56 |
Constraint::~Constraint() |
| 57 |
{ |
| 58 |
} |
| 59 |
|
| 60 |
void Constraint::InitSerializable() |
| 61 |
{ |
| 62 |
XS_SERIALIZE(m_name, wxT("name")); |
| 63 |
XS_SERIALIZE(m_localColumn, wxT("localColumn")); |
| 64 |
XS_SERIALIZE_INT(m_type, wxT("type")); |
| 65 |
XS_SERIALIZE(m_refTable, wxT("refTable")); |
| 66 |
XS_SERIALIZE(m_refCol, wxT("refCol")); |
| 67 |
XS_SERIALIZE_INT(m_onDelete,wxT("onDelete")); |
| 68 |
XS_SERIALIZE_INT(m_onUpdate,wxT("onUpdate")); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
|