6 #if defined(USE_DBAPI_PGSQL)
7 #define DBAPI2_DEFAULT "pgsql"
8 #elseif defined(USE_DBAPI_SQLITE)
9 #define DBAPI2_DEFAULT "sqlite"
11 #define DBAPI2_DEFAULT NULL
20 #define DBAPI2_HANDLE void
23 #ifndef DBAPI2_RESULT_HANDLE
24 #define DBAPI2_RESULT_HANDLE void
27 typedef void *DBAPIUserData
;
31 typedef DBAPI2_HANDLE
*(*DBAPINew
)(struct DBAPIConn
*);
32 typedef void (*DBAPIClose
)(struct DBAPIConn
*);
34 typedef void (*DBAPIQueryCallback
)(struct DBAPIResult
*, void *);
36 typedef void (*DBAPIQuery
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...);
37 typedef void (*DBAPISimpleQuery
)(struct DBAPIConn
*, const char *, ...);
38 typedef void (*DBAPIQueryV
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, va_list);
39 typedef void (*DBAPICreateTable
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...);
40 typedef void (*DBAPILoadTable
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIUserData
, const char *);
42 typedef void (*DBAPISafeQuery
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, ...);
43 typedef void (*DBAPISafeQueryV
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, va_list);
44 typedef void (*DBAPISafeSimpleQuery
)(struct DBAPIConn
*, const char *, const char *, ...);
45 typedef void (*DBAPISafeCreateTable
)(struct DBAPIConn
*, const char *, ...);
46 typedef void (*DBAPISafeLoadTable
)(struct DBAPIConn
*, const char *, ...);
48 typedef void (*DBAPIEscapeString
)(struct DBAPIConn
*, char *, const char *, size_t);
49 typedef int (*DBAPIQuoteString
)(struct DBAPIConn
*, char *, size_t, const char *, size_t);
51 struct DBAPIProviderData
;
53 typedef struct DBAPIProvider
{
58 DBAPICreateTable createtable
;
59 DBAPILoadTable loadtable
;
61 DBAPISafeQuery safequery;
62 DBAPISafeSimpleQuery safesimplequery;
63 DBAPISafeCreateTable safecreatetable;
64 DBAPISafeLoadTable safeloadtable;
67 DBAPIEscapeString escapestring
;
68 DBAPIQuoteString quotestring
;
71 struct DBAPIProviderData
*__providerdata
;
74 typedef struct DBAPIConn
{
78 DBAPISimpleQuery squery
;
79 DBAPICreateTable createtable
;
80 DBAPILoadTable loadtable
;
81 DBAPIEscapeString escapestring
; /* deprecated */
83 char name
[DBNAME_LEN
+1];
89 DBAPIQuoteString __quotestring
;
93 typedef char *(*DBAPIResultGet
)(struct DBAPIResult
*, int);
94 typedef int (*DBAPIResultNext
)(struct DBAPIResult
*);
95 typedef void (*DBAPIResultClear
)(struct DBAPIResult
*);
97 typedef struct DBAPIResult
{
98 DBAPI2_RESULT_HANDLE
*handle
;
100 unsigned short success
, fields
;
103 DBAPIResultNext next
;
104 DBAPIResultClear clear
;
107 int registerdbprovider(const char *, DBAPIProvider
*);
108 void deregisterdbprovider(int);
109 DBAPIConn
*dbapi2open(const char *, int, const char *);
111 void dbsnprintf(DBAPIConn
*, char *, size_t, const char *, const char *, ...);