1/**
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LUA_DBD_H_
19#define _LUA_DBD_H_
20
21#include "mod_lua.h"
22#include "apr.h"
23#include "apr_dbd.h"
24#include "mod_dbd.h"
25
26#define LUA_DBTYPE_APR_DBD 0
27#define LUA_DBTYPE_MOD_DBD 1
28typedef struct
29{
30    apr_dbd_t               *handle;
31    const apr_dbd_driver_t  *driver;
32    int                     alive;
33    apr_pool_t              *pool;
34    char                    type;
35    ap_dbd_t *              dbdhandle;
36    server_rec              *server;
37} lua_db_handle;
38
39typedef struct {
40    const apr_dbd_driver_t  *driver;
41    int                     rows;
42    int                     cols;
43    apr_dbd_results_t       *results;
44    apr_pool_t              *pool;
45} lua_db_result_set;
46
47typedef struct {
48    apr_dbd_prepared_t      *statement;
49    int                     variables;
50    lua_db_handle           *db;
51} lua_db_prepared_statement;
52
53int lua_db_acquire(lua_State* L);
54int lua_db_escape(lua_State* L);
55int lua_db_close(lua_State* L);
56int lua_db_prepare(lua_State* L);
57int lua_db_prepared(lua_State* L);
58int lua_db_select(lua_State* L);
59int lua_db_query(lua_State* L);
60int lua_db_prepared_select(lua_State* L);
61int lua_db_prepared_query(lua_State* L);
62int lua_db_get_row(lua_State* L);
63int lua_db_gc(lua_State* L);
64int lua_db_active(lua_State* L);
65
66#endif /* !_LUA_DBD_H_ */
67