8 #define DBAPI2_DEFAULT NULL
16 #define DBAPI2_HANDLE void
19 #ifndef DBAPI2_RESULT_HANDLE
20 #define DBAPI2_RESULT_HANDLE void
23 typedef void *DBAPIUserData
;
27 typedef DBAPI2_HANDLE
*(*DBAPINew
)(struct DBAPIConn
*);
28 typedef void (*DBAPIClose
)(struct DBAPIConn
*);
30 typedef void (*DBAPIQueryCallback
)(struct DBAPIResult
*, void *);
32 typedef void (*DBAPIQuery
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...) __attribute__ ((format (printf
, 4, 5)));
33 typedef void (*DBAPISimpleQuery
)(struct DBAPIConn
*, const char *, ...) __attribute__ ((format (printf
, 2, 3)));
34 typedef void (*DBAPIQueryV
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, va_list);
35 typedef void (*DBAPICreateTable
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...) __attribute__ ((format (printf
, 4, 5)));
36 typedef void (*DBAPILoadTable
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIUserData
, const char *);
38 typedef void (*DBAPISafeQuery
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, ...);
39 typedef void (*DBAPISafeQueryV
)(struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, va_list);
40 typedef void (*DBAPISafeSimpleQuery
)(struct DBAPIConn
*, const char *, const char *, ...);
41 typedef void (*DBAPISafeCreateTable
)(struct DBAPIConn
*, const char *, ...) __attribute__ ((format (printf
, 2, 3)));
43 typedef void (*DBAPIEscapeString
)(struct DBAPIConn
*, char *, const char *, size_t);
44 typedef int (*DBAPIQuoteString
)(struct DBAPIConn
*, char *, size_t, const char *, size_t);
46 struct DBAPIProviderData
;
48 typedef struct DBAPIProvider
{
53 DBAPICreateTable createtable
;
54 DBAPILoadTable loadtable
;
56 DBAPISafeQuery safequery;
57 DBAPISafeSimpleQuery safesimplequery;
58 DBAPISafeCreateTable safecreatetable;
61 DBAPIEscapeString escapestring
;
62 DBAPIQuoteString quotestring
;
65 struct DBAPIProviderData
*__providerdata
;
68 typedef struct DBAPIConn
{
72 DBAPISimpleQuery squery
;
73 DBAPICreateTable createtable
;
74 DBAPILoadTable loadtable
;
75 DBAPIEscapeString escapestring
; /* deprecated */
77 char name
[DBNAME_LEN
+1];
83 DBAPIQuoteString __quotestring
;
87 typedef char *(*DBAPIResultGet
)(struct DBAPIResult
*, int);
88 typedef int (*DBAPIResultNext
)(struct DBAPIResult
*);
89 typedef void (*DBAPIResultClear
)(struct DBAPIResult
*);
91 typedef struct DBAPIResult
{
92 DBAPI2_RESULT_HANDLE
*handle
;
94 unsigned short success
, fields
;
98 DBAPIResultClear clear
;
101 int registerdbprovider(const char *, DBAPIProvider
*);
102 void deregisterdbprovider(int);
103 DBAPIConn
*dbapi2open(const char *, const char *);
105 void dbsnprintf(DBAPIConn
*, char *, size_t, const char *, const char *, ...);