This repository was archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbobject.cc
More file actions
103 lines (89 loc) · 2.84 KB
/
Copy pathdbobject.cc
File metadata and controls
103 lines (89 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* @file dbobject.cc
* @brief Definitions for DbObject class.
* @author Nicu Tofan <nicu.tofan@gmail.com>
* @copyright Copyright 2015 piles contributors. All rights reserved.
* This file is released under the
* [MIT License](http://opensource.org/licenses/mit-license.html)
*/
#include "dbobject.h"
#include "dbstruct-private.h"
#include "dbstruct.h"
#include "dbcolumn.h"
#include "dbrecord.h"
#include "dbtable.h"
#include "dbview.h"
#include <QCryptographicHash>
/**
* @class DbObject
*
* Detailed description.
*/
/* ------------------------------------------------------------------------- */
/**
*/
DbObject::DbObject()
{
DBSTRUCT_TRACE_ENTRY;
DBSTRUCT_TRACE_EXIT;
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/**
*/
DbObject::~DbObject()
{
DBSTRUCT_TRACE_ENTRY;
DBSTRUCT_TRACE_EXIT;
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
DbStructMeta * DbObject::asStruct ()
{
if (type () != DBO_STRUCT)
return NULL;
return static_cast<DbStructMeta*>(this);
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
DbColumn * DbObject::asColumn ()
{
if (type () != DBO_COLUMN)
return NULL;
return static_cast<DbColumn*>(this);
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
DbRecord * DbObject::asRecord ()
{
if (type () != DBO_RECORD)
return NULL;
// return static_cast<DbRecord*>(this);
return NULL;
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
DbTable * DbObject::asTable ()
{
if (type () != DBO_TABLE)
return NULL;
return static_cast<DbTable*>(this);
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
DbView * DbObject::asView ()
{
if ((type () == DBO_SUBSET) || (type () == DBO_CPLX_VIEW))
return static_cast<DbView*>(this);
return NULL;
}
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
QString DbObject::md5Hash (const QString &input)
{
return QString(QCryptographicHash::hash(
input.toLatin1(),
QCryptographicHash::Md5)
.toHex());
}
/* ========================================================================= */