~mapopa/flamerobin/master

« back to all changes in this revision

Viewing changes to src/metadata/constraints.h

  • Committer: Michael Hieke
  • Date: 2004-11-22 11:34:42 UTC
  • Revision ID: git-v1:8153b493d66ee7aae55e7b34e0d7bddacf4999ef
Initial revision

svn path=/trunk/flamerobin/; revision=13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  The contents of this file are subject to the Initial Developer's Public
 
3
  License Version 1.0 (the "License"); you may not use this file except in
 
4
  compliance with the License. You may obtain a copy of the License here:
 
5
  http://www.flamerobin.org/license.html.
 
6
 
 
7
  Software distributed under the License is distributed on an "AS IS"
 
8
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 
9
  License for the specific language governing rights and limitations under
 
10
  the License.
 
11
 
 
12
  The Original Code is FlameRobin (TM).
 
13
 
 
14
  The Initial Developer of the Original Code is Milan Babuskov.
 
15
 
 
16
  Portions created by the original developer
 
17
  are Copyright (C) 2004 Milan Babuskov.
 
18
 
 
19
  All Rights Reserved.
 
20
 
 
21
  Contributor(s):
 
22
*/
 
23
 
 
24
#ifndef FR_CONSTRAINTS_H
 
25
#define FR_CONSTRAINTS_H
 
26
 
 
27
#include <string>
 
28
#include <vector>
 
29
#include "metadataitem.h"
 
30
//------------------------------------------------------------------------------
 
31
// These could all be simple "struct"s but we want to add some functionality later
 
32
//
 
33
class Constraint: public YxMetadataItem
 
34
{
 
35
// nothing needed yet, but it may be once
 
36
};
 
37
//------------------------------------------------------------------------------
 
38
//! primary keys and uniques
 
39
class ColumnConstraint: public Constraint
 
40
{
 
41
public:
 
42
        typedef std::vector<std::string>::const_iterator const_iterator;
 
43
        //std::string indexName; needed?
 
44
        std::vector<std::string> columnsM;
 
45
 
 
46
        std::string getColumnList() const;
 
47
        const_iterator begin() { return columnsM.begin(); };
 
48
        const_iterator end() { return columnsM.end(); };
 
49
};
 
50
//------------------------------------------------------------------------------
 
51
//! checks
 
52
class CheckConstraint: public Constraint
 
53
{
 
54
public:
 
55
        std::string sourceM;
 
56
};
 
57
//------------------------------------------------------------------------------
 
58
//! foreign keys
 
59
class ForeignKey: public ColumnConstraint
 
60
{
 
61
public:
 
62
        std::string referencedTableM;                                   // referenced table
 
63
        std::vector<std::string> referencedColumnsM;    // referenced columns
 
64
        std::string updateActionM;
 
65
        std::string deleteActionM;
 
66
        std::string getReferencedColumnList() const;
 
67
};
 
68
//------------------------------------------------------------------------------
 
69
#endif