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
)(const struct DBAPIConn
*);
28 typedef void (*DBAPIClose
)(struct DBAPIConn
*);
30 typedef void (*DBAPIQueryCallback
)(const struct DBAPIResult
*, void *);
32 typedef void (*DBAPIQuery
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...) __attribute__ ((format (printf
, 4, 5)));
33 typedef void (*DBAPISimpleQuery
)(const struct DBAPIConn
*, const char *, ...) __attribute__ ((format (printf
, 2, 3)));
34 typedef void (*DBAPIQueryV
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *);
35 typedef void (*DBAPICreateTable
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, ...) __attribute__ ((format (printf
, 4, 5)));
36 typedef void (*DBAPICreateTableV
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *);
37 typedef void (*DBAPILoadTable
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIQueryCallback
, DBAPIUserData
, const char *);
39 typedef void (*DBAPISafeQuery
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, ...);
40 typedef void (*DBAPISafeSimpleQuery
)(const struct DBAPIConn
*, const char *, const char *, ...);
41 typedef void (*DBAPISafeCreateTable
)(const struct DBAPIConn
*, DBAPIQueryCallback
, DBAPIUserData
, const char *, const char *, ...);
43 typedef void (*DBAPIEscapeString
)(const struct DBAPIConn
*, char *, const char *, size_t);
44 typedef int (*DBAPIQuoteString
)(const struct DBAPIConn
*, char *, size_t, const char *, size_t);
46 typedef char *(*DBAPITableName
)(const struct DBAPIConn
*, const char *);
48 struct DBAPIProviderData
;
50 typedef struct DBAPIProvider
{
55 DBAPICreateTableV createtable
;
56 DBAPILoadTable loadtable
;
58 DBAPITableName tablename
;
60 DBAPIEscapeString escapestring
;
61 DBAPIQuoteString quotestring
;
64 struct DBAPIProviderData
*__providerdata
;
67 typedef struct DBAPIConn
{
70 DBAPIQuery unsafequery
;
71 DBAPISimpleQuery unsafesquery
;
72 DBAPICreateTable unsafecreatetable
;
73 DBAPILoadTable loadtable
;
74 DBAPIEscapeString escapestring
; /* deprecated */
75 DBAPITableName tablename
;
78 DBAPISafeSimpleQuery squery
;
79 DBAPISafeCreateTable createtable
;
81 char name
[DBNAME_LEN
+1];
87 DBAPIQuoteString __quotestring
;
89 DBAPICreateTableV __createtable
;
92 typedef char *(*DBAPIResultGet
)(const struct DBAPIResult
*, unsigned int);
93 typedef int (*DBAPIResultNext
)(const struct DBAPIResult
*);
94 typedef void (*DBAPIResultClear
)(const struct DBAPIResult
*);
96 typedef struct DBAPIResult
{
97 DBAPI2_RESULT_HANDLE
*handle
;
99 unsigned short success
, fields
;
102 DBAPIResultNext next
;
103 DBAPIResultClear clear
;
106 int registerdbprovider(const char *, DBAPIProvider
*);
107 void deregisterdbprovider(int);
108 DBAPIConn
*dbapi2open(const char *, const char *);