-
Notifications
You must be signed in to change notification settings - Fork 153
/
Functions.h
64 lines (47 loc) · 2.2 KB
/
Functions.h
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
/************************************************************************
* Copyright(c) 2010, One Unified. All rights reserved. *
* email: info@oneunified.net *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
#pragma once
#include <string>
namespace ou {
namespace db {
// fields
template<typename Action, typename T> // A=Action, T=Type
void Field( Action& action, const std::string& sFieldName, T& var ) {
action.Field( sFieldName, var );
};
template<typename Action, typename T> // A=Action, T=Type
void Field( Action& action, const std::string& sFieldName, T& var, const std::string& sFieldType ) {
action.Field( sFieldName, var, sFieldType );
};
template<typename Action> // A=Action
void Key( Action& action, const std::string& sFieldName ) {
action.Key( sFieldName );
}
// where
template<typename Action, typename T> // A=Action, T=Type
void Where( Action& action, const std::string& sName, T& var ) { // expand functionality at a later date, defaults to '=' currently
action.Where( sName, var );
};
// orderby
template<typename Action> // A=Action
void OrderBy( Action& action, const std::string& sName ) {
action.OrderBy( sName );
};
// constraint
template<typename Action> // A=Action
void Constraint( Action& action, const std::string& sLocalKey, const std::string& sRemoteTable, const std::string& sRemoteKey ) {
action.Constraint( sLocalKey, sRemoteTable, sRemoteKey );
};
} // db
} // ou