summaryrefslogtreecommitdiff
path: root/include/LuaOCCI.h
blob: b271bbbca360f522ab00eeaf6f62d5f5ad2c3098 (plain)
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
#ifndef __LUAOCCI_H__
#define __LUAOCCI_H__

#include <Exceptions.h>
#include <BLua.h>

#ifdef __MINGW32__
#include "OCCI-proxy.h"
#define ORAPREFIX occi_proxy
#else
#include <occi.h>
#define ORAPREFIX oracle::occi
#endif

#define DECLARE_OCCI_ENCAP(clname) \
class EncapOCCI_##clname : public Base { \
  public: \
      EncapOCCI_##clname(ORAPREFIX::clname * _o) : o(_o) { } \
      ~EncapOCCI_##clname() { } \
    ORAPREFIX::clname * Get() { return o; } \
    bool disableExceptions; \
    String lastError_msg; \
    int lastError_code; \
  private: \
    ORAPREFIX::clname * o; \
}; \
\
class LuaOCCI_##clname : public LuaObject { \
  public: \
    static void pushstatics(Lua *) throw (GeneralException); \
      LuaOCCI_##clname(EncapOCCI_##clname * _o) : o(_o) { } \
      ~LuaOCCI_##clname() { } \
  private: \
    virtual void pushmembers(Lua *); \
    EncapOCCI_##clname * o; \
};

DECLARE_OCCI_ENCAP(Environment);
DECLARE_OCCI_ENCAP(Connection);
DECLARE_OCCI_ENCAP(Statement);
DECLARE_OCCI_ENCAP(ResultSet);
DECLARE_OCCI_ENCAP(Stream);

#define LuaOCCI_pushstatics(L) {\
    LuaOCCI_Environment::pushstatics(L);\
    LuaOCCI_Connection::pushstatics(L);\
    LuaOCCI_Statement::pushstatics(L);\
    LuaOCCI_ResultSet::pushstatics(L);\
    LuaOCCI_Stream::pushstatics(L);\
}

#endif