-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibpqxx1C.h
107 lines (98 loc) · 3.51 KB
/
libpqxx1C.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
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
104
105
106
107
#ifndef __ADDINNATIVE_H__
#define __ADDINNATIVE_H__
#include "./include/ComponentBase.h"
#include "./include/AddInDefBase.h"
#include "./include/IMemoryManager.h"
void LogToFile(const wchar_t* msg);
void LogToFile(const char* msg);
///////////////////////////////////////////////////////////////////////////////
// class CAddInlibpqxx1C
class CAddInlibpqxx1C : public IComponentBase
{
public:
enum Props
{
ePropColumnsCount = 0,
ePropRowsCount,
ePropEOD,
ePropErrorDesc,
eLastProp // Always last
};
enum Methods
{
eMethConnect = 0,
eMethDisconnect,
eMethExecuteSelect,
eMethNextRow,
eMethNextCell,
eMethGetColumnType,
eMethGetColumnName,
eMethExecuteQuery,
eLastMethod // Always last
};
CAddInlibpqxx1C(void);
virtual ~CAddInlibpqxx1C();
// IInitDoneBase
virtual bool ADDIN_API Init(void*);
virtual bool ADDIN_API setMemManager(void* mem);
virtual long ADDIN_API GetInfo();
virtual void ADDIN_API Done();
// ILanguageExtenderBase
virtual bool ADDIN_API RegisterExtensionAs(WCHAR_T**);
virtual long ADDIN_API GetNProps();
virtual long ADDIN_API FindProp(const WCHAR_T* wsPropName);
virtual const WCHAR_T* ADDIN_API GetPropName(long lPropNum, long lPropAlias);
virtual bool ADDIN_API GetPropVal(const long lPropNum, tVariant* pvarPropVal);
virtual bool ADDIN_API SetPropVal(const long lPropNum, tVariant* varPropVal);
virtual bool ADDIN_API IsPropReadable(const long lPropNum);
virtual bool ADDIN_API IsPropWritable(const long lPropNum);
virtual long ADDIN_API GetNMethods();
virtual long ADDIN_API FindMethod(const WCHAR_T* wsMethodName);
virtual const WCHAR_T* ADDIN_API GetMethodName(const long lMethodNum,
const long lMethodAlias);
virtual long ADDIN_API GetNParams(const long lMethodNum);
virtual bool ADDIN_API GetParamDefValue(const long lMethodNum, const long lParamNum,
tVariant *pvarParamDefValue);
virtual bool ADDIN_API HasRetVal(const long lMethodNum);
virtual bool ADDIN_API CallAsProc(const long lMethodNum,
tVariant* paParams, const long lSizeArray);
virtual bool ADDIN_API CallAsFunc(const long lMethodNum,
tVariant* pvarRetValue, tVariant* paParams, const long lSizeArray);
operator IComponentBase* () { return (IComponentBase*)this; }
// LocaleBase
virtual void ADDIN_API SetLocale(const WCHAR_T* loc);
private:
long findName(wchar_t* names[], const wchar_t* name, const uint32_t size) const;
void addError(uint32_t wcode, const wchar_t* source,
const wchar_t* descriptor, long code);
void Raise1CException(const char* err, const bool decode);
// Attributes
IAddInDefBase *m_iConnect;
IMemoryManager *m_iMemory;
bool m_boolEnabled;
uint32_t m_uiTimer;
};
class WcharWrapper
{
public:
#ifdef LINUX_OR_MACOS
WcharWrapper(const WCHAR_T* str);
#endif
WcharWrapper(const wchar_t* str);
~WcharWrapper();
#ifdef LINUX_OR_MACOS
operator const WCHAR_T* () { return m_str_WCHAR; }
operator WCHAR_T* () { return m_str_WCHAR; }
#endif
operator const wchar_t* () { return m_str_wchar; }
operator wchar_t* () { return m_str_wchar; }
private:
WcharWrapper& operator = (const WcharWrapper& other) { return *this; }
WcharWrapper(const WcharWrapper& other) { }
private:
#ifdef LINUX_OR_MACOS
WCHAR_T* m_str_WCHAR;
#endif
wchar_t* m_str_wchar;
};
#endif //__ADDINNATIVE_H__