Sat, 30 Jun 2012 00:37:19 +0200
MySQL: Fix off-by-one in allocation and pass address of correct bind result buffer to mysql_stmt_fetch_column()
17
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
1 | #include "dbd_oracle.h" |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
2 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
3 | int dbd_oracle_statement_create(lua_State *L, connection_t *conn, const char *sql_query); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
4 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
5 | static int commit(connection_t *conn) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
6 | int rc = OCITransCommit(conn->svc, conn->err, OCI_DEFAULT); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
7 | return rc; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
8 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
9 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
10 | static int rollback(connection_t *conn) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
11 | int rc = OCITransRollback(conn->svc, conn->err, OCI_DEFAULT); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
12 | return rc; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
13 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
14 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
15 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
16 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
17 | * connection,err = DBD.Oracle.New(dbfile) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
18 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
19 | static int connection_new(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
20 | int n = lua_gettop(L); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
21 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
22 | int rc = 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
23 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
24 | const char *user = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
25 | const char *password = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
26 | const char *db = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
27 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
28 | OCIEnv *env = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
29 | OCIError *err = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
30 | OCISvcCtx *svc = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
31 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
32 | connection_t *conn = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
33 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
34 | /* db, user, password */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
35 | switch(n) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
36 | case 5: |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
37 | case 4: |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
38 | case 3: |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
39 | if (lua_isnil(L, 3) == 0) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
40 | password = luaL_checkstring(L, 3); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
41 | case 2: |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
42 | if (lua_isnil(L, 2) == 0) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
43 | user = luaL_checkstring(L, 2); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
44 | case 1: |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
45 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
46 | * db is the only mandatory parameter |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
47 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
48 | db = luaL_checkstring(L, 1); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
49 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
50 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
51 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
52 | * initialise OCI |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
53 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
54 | OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, (dvoid * (*)(dvoid *, size_t))0, (dvoid * (*)(dvoid *, dvoid *, size_t))0, (void (*)(dvoid *, dvoid *))0); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
55 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
56 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
57 | * initialise environment |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
58 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
59 | OCIEnvInit((OCIEnv **)&env, OCI_DEFAULT, 0, (dvoid **)0); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
60 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
61 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
62 | * server contexts |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
63 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
64 | OCIHandleAlloc((dvoid *)env, (dvoid **)&err, OCI_HTYPE_ERROR, 0, (dvoid **)0); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
65 | OCIHandleAlloc((dvoid *)env, (dvoid **)&svc, OCI_HTYPE_SVCCTX, 0, (dvoid **)0); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
66 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
67 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
68 | * connect to database server |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
69 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
70 | rc = OCILogon(env, err, &svc, user, strlen(user), password, strlen(password), db, strlen(db)); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
71 | if (rc != 0) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
72 | char errbuf[100]; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
73 | int errcode; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
74 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
75 | OCIErrorGet((dvoid *)err, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
76 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
77 | lua_pushnil(L); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
78 | lua_pushfstring(L, DBI_ERR_CONNECTION_FAILED, errbuf); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
79 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
80 | return 2; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
81 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
82 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
83 | conn = (connection_t *)lua_newuserdata(L, sizeof(connection_t)); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
84 | conn->oracle = env; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
85 | conn->err = err; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
86 | conn->svc = svc; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
87 | conn->autocommit = 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
88 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
89 | luaL_getmetatable(L, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
90 | lua_setmetatable(L, -2); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
91 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
92 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
93 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
94 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
95 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
96 | * success = connection:autocommit(on) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
97 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
98 | static int connection_autocommit(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
99 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
100 | int on = lua_toboolean(L, 2); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
101 | int err = 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
102 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
103 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
104 | if (on) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
105 | rollback(conn); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
106 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
107 | conn->autocommit = on; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
108 | err = 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
109 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
110 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
111 | lua_pushboolean(L, !err); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
112 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
113 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
114 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
115 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
116 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
117 | * success = connection:close() |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
118 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
119 | static int connection_close(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
120 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
121 | int disconnect = 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
122 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
123 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
124 | rollback(conn); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
125 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
126 | OCILogoff(conn->svc, conn->err); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
127 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
128 | if (conn->svc) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
129 | OCIHandleFree((dvoid *)conn->svc, OCI_HTYPE_ENV); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
130 | if (conn->err) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
131 | OCIHandleFree((dvoid *)conn->err, OCI_HTYPE_ERROR); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
132 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
133 | disconnect = 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
134 | conn->oracle = NULL; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
135 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
136 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
137 | lua_pushboolean(L, disconnect); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
138 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
139 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
140 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
141 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
142 | * success = connection:commit() |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
143 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
144 | static int connection_commit(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
145 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
146 | int err = 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
147 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
148 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
149 | err = commit(conn); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
150 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
151 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
152 | lua_pushboolean(L, !err); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
153 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
154 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
155 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
156 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
157 | * ok = connection:ping() |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
158 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
159 | static int connection_ping(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
160 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
161 | int ok = 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
162 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
163 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
164 | ok = 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
165 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
166 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
167 | lua_pushboolean(L, ok); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
168 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
169 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
170 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
171 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
172 | * statement,err = connection:prepare(sql_str) |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
173 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
174 | static int connection_prepare(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
175 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
176 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
177 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
178 | return dbd_oracle_statement_create(L, conn, luaL_checkstring(L, 2)); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
179 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
180 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
181 | lua_pushnil(L); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
182 | lua_pushstring(L, DBI_ERR_DB_UNAVAILABLE); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
183 | return 2; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
184 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
185 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
186 | /* |
22 | 187 | * quoted = connection:quote(str) |
188 | */ | |
189 | static int connection_quote(lua_State *L) { | |
190 | luaL_error(L, DBI_ERR_NOT_IMPLEMENTED, DBD_ORACLE_CONNECTION, "quote"); | |
191 | return 0; | |
192 | } | |
193 | ||
194 | /* | |
17
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
195 | * success = connection:rollback() |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
196 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
197 | static int connection_rollback(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
198 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
199 | int err = 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
200 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
201 | if (conn->oracle) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
202 | err = rollback(conn); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
203 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
204 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
205 | lua_pushboolean(L, !err); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
206 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
207 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
208 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
209 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
210 | * __gc |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
211 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
212 | static int connection_gc(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
213 | /* always close the connection */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
214 | connection_close(L); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
215 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
216 | return 0; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
217 | } |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
218 | |
32
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
219 | /* |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
220 | * __tostring |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
221 | */ |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
222 | static int connection_tostring(lua_State *L) { |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
223 | connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_ORACLE_CONNECTION); |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
224 | |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
225 | lua_pushfstring(L, "%s: %p", DBD_ORACLE_CONNECTION, conn); |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
226 | |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
227 | return 1; |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
228 | } |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
229 | |
17
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
230 | int dbd_oracle_connection(lua_State *L) { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
231 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
232 | * instance methods |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
233 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
234 | static const luaL_Reg connection_methods[] = { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
235 | {"autocommit", connection_autocommit}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
236 | {"close", connection_close}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
237 | {"commit", connection_commit}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
238 | {"ping", connection_ping}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
239 | {"prepare", connection_prepare}, |
22 | 240 | {"quote", connection_quote}, |
17
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
241 | {"rollback", connection_rollback}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
242 | {NULL, NULL} |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
243 | }; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
244 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
245 | /* |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
246 | * class methods |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
247 | */ |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
248 | static const luaL_Reg connection_class_methods[] = { |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
249 | {"New", connection_new}, |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
250 | {NULL, NULL} |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
251 | }; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
252 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
253 | luaL_newmetatable(L, DBD_ORACLE_CONNECTION); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
254 | luaL_register(L, 0, connection_methods); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
255 | lua_pushvalue(L,-1); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
256 | lua_setfield(L, -2, "__index"); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
257 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
258 | lua_pushcfunction(L, connection_gc); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
259 | lua_setfield(L, -2, "__gc"); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
260 | |
32
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
261 | lua_pushcfunction(L, connection_tostring); |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
262 | lua_setfield(L, -2, "__tostring"); |
03ed0ca09837
Add __tostring method to connection and statement objects.
nrich@ii.net
parents:
22
diff
changeset
|
263 | |
17
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
264 | luaL_register(L, DBD_ORACLE_CONNECTION, connection_class_methods); |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
265 | |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
266 | return 1; |
21c4feaeafe7
Added initial Oracle driver support - functionality is complete, but may be too buggy in its current state for any serious use.
nrich@ii.net
parents:
diff
changeset
|
267 | } |