-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb_wrap_dbi.h
61 lines (47 loc) · 2 KB
/
db_wrap_dbi.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
#if !defined(_MERLIN_DB_WRAP_DBI_H_INCLUDED)
#define _MERLIN_DB_WRAP_DBI_H_INCLUDED 1
#include "db_wrap.h"
#include <dbi/dbi.h>
/*
typedef void * dbi_conn;
typedef void * dbi_result;
*/
/**
Initializes a db_wrap object using a libdbi backend.
conn must be an initalized libdbi connection object. On success,
ownership of that connection object is passed to the returned
object, and it will be closed when the returned object is
finalized.
param must be non-null and must contain connection parameters for
the given connection object. tgt must be non-null and *tgt must
point to NULL.
On success 0 is returned, *tgt is assigned to the wrapper object,
which now owns conn and which the caller must eventually free by
calling (*tgt)->api->finalize(*tgt).
The connection is not opened by this function: call
tgt->api->connect(tgt) to do that.
*/
int db_wrap_dbi_init(dbi_conn conn, db_wrap_conn_params const * param, db_wrap ** tgt);
/**
Functionally identical to db_wrap_dbi_init(), but it takes a libdbi
driver name as the first argument. e.g. "mysql" or "sqlite3".
Returns 0 on success.
*/
int db_wrap_dbi_init2(char const * driver, db_wrap_conn_params const * param, db_wrap ** tgt);
/**
A temporary function for use only while porting the dbi-using bits
to db_wrap. If db was created by the DBI-based driver then its
dbi-native handle is returned. That object is owned by the
db_wrap_result object and MUST NOT be destroyed by the caller.
This function will go away once the port is complete.
*/
dbi_conn db_wrap_dbi_conn(db_wrap * db);
/**
A temporary function for use only while porting the dbi-using bits
to db_wrap. If db was created by the DBI-based driver then its
dbi-native result is returned. That object is owned by the
db_wrap_result object and MUST NOT be destroyed by the caller.
This function will go away once the port is complete.
*/
dbi_result db_wrap_dbi_result(db_wrap_result * db);
#endif /* _MERLIN_DB_WRAP_DBI_H_INCLUDED */