-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathUtils.h
More file actions
75 lines (48 loc) · 1.75 KB
/
Copy pathUtils.h
File metadata and controls
75 lines (48 loc) · 1.75 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
// Copyright © 2003 CCP ehf.
/*
*************************************************************************
Utils.h
Project: EVE Server Database Access
Description:
Utility functions and stuff that doesn't fit into any other file.
Dependencies:
Python
*************************************************************************
*/
#ifndef _UTILS_H_
#define _UTILS_H_
#include <string>
#include <vector>
class Session;
namespace Utilities
{
bool InitUtilities(PyObject* dbModuleDict);
bool UninitUtilities();
const char* DBTypeName(DBTYPE type);
size_t GetSizeofDBType(DBTYPE bType);
// Error facility
extern PyObject* DbExc_RuntimeError; // inherited from exceptions.RuntimeError
extern PyObject* DbExc_WindowsError; // inherited from exceptions.WindowsError
extern PyObject* DbExc_SQLError; // imported from /lib/ccp_exceptions.py
extern PyObject* DbExc_ConnectionError; // imported from /lib/ccp_exceptions.py
PyObject* SetErr32(int err, const char* format, ...);
PyObject* SetErrBlue(const char* format, ...);
void FormatErrorRec(std::vector<std::wstring> &result, ULONG ne, const CDBErrorInfo &ei);
PyObject* ErrorRecToPy(const CDBErrorInfo *ei, ULONG ne);
bool ParamErrorsToPy(HRESULT hr, ATL::CDynamicParameterAccessor &accessor, PyObject **paramErrors, PyObject **columnErrors);
bool IsSoftError(HRESULT hr);
PyObject* ErrorClass(HRESULT hr);
}
#define CHECKERR(_hr, _why) \
do {if (FAILED(_hr)){\
return Utilities::SetErr32(_hr, _why);} \
}while (0)
#define CHECKERR1(_hr, _why, _arg1) \
do {if (FAILED(_hr)){\
return Utilities::SetErr32(_hr, _why, _arg1);} \
}while (0)
#define CHECKERR2(_hr, _why, _arg1, _arg2) \
do {if (FAILED(_hr)){\
return Utilities::SetErr32(_hr, _why, _arg1, _arg2);} \
}while (0)
#endif