1 /* $Id: Sybase.h,v 1.21 2011/10/02 14:53:49 mpeppler Exp $
2 
3    Copyright (c) 1997 - 2011 Michael Peppler
4 
5    You may distribute under the terms of either the GNU General Public
6    License or the Artistic License, as specified in the Perl README file.
7 
8 */
9 
10 
11 
12 #define NEED_DBIXS_VERSION 93
13 
14 #define PERL_NO_GET_CONTEXT
15 
16 #include <DBIXS.h>		/* installed by the DBI module	*/
17 #include "dbivport.h"
18 
19 #include <ctpublic.h>
20 #include <bkpublic.h>
21 
22 /* These defines avoid name clashes for multiple statically linked DBD's    */
23 
24 #define dbd_init        syb_init
25 #define dbd_db_login6       syb_db_login
26 #define dbd_db_do       syb_db_do
27 #define dbd_db_commit       syb_db_commit
28 #define dbd_db_rollback     syb_db_rollback
29 #define dbd_db_disconnect   syb_db_disconnect
30 #define dbd_discon_all   syb_discon_all
31 #define dbd_db_destroy      syb_db_destroy
32 #define dbd_db_STORE_attrib syb_db_STORE_attrib
33 #define dbd_db_FETCH_attrib syb_db_FETCH_attrib
34 #define dbd_st_prepare      syb_st_prepare
35 #define dbd_st_rows     syb_st_rows
36 #define dbd_st_execute      syb_st_execute
37 #define dbd_st_fetch        syb_st_fetch
38 #define dbd_st_finish       syb_st_finish
39 #define dbd_st_destroy      syb_st_destroy
40 #define dbd_st_blob_read    syb_st_blob_read
41 #define dbd_st_STORE_attrib syb_st_STORE_attrib
42 #define dbd_st_FETCH_attrib syb_st_FETCH_attrib
43 #define dbd_describe        syb_describe
44 #define dbd_bind_ph     syb_bind_ph
45 
46 
47 
48 /* read in our implementation details */
49 
50 #include "dbdimp.h"
51 
52 #if defined(CS_CURRENT_VERSION)
53 #define CTLIB_VERSION	CS_CURRENT_VERSION
54 #else
55 #if defined(CS_VERSION_157)
56 #define CTLIB_VERSION   CS_VERSION_157
57 #else
58 #if defined(CS_VERSION_155)
59 #define CTLIB_VERSION   CS_VERSION_155
60 #else
61 #if defined(CS_VERSION_150)
62 #define CTLIB_VERSION   CS_VERSION_150
63 #else
64 #if defined(CS_VERSION_125)
65 #define CTLIB_VERSION   CS_VERSION_125
66 #else
67 #if defined(CS_VERSION_120)
68 #define CTLIB_VERSION   CS_VERSION_120
69 #else
70 #if defined(CS_VERSION_110)
71 #define CTLIB_VERSION   CS_VERSION_110
72 #else
73 #define CTLIB_VERSION	CS_VERSION_100
74 #endif
75 #endif
76 #endif
77 #endif
78 #endif
79 #endif
80 #endif
81 
82 #if defined(CS_UNICHAR_TYPE) && defined(CS_VERSION_150)
83 #if defined (is_utf8_string)
84 #define DBD_CAN_HANDLE_UTF8
85 #endif
86 #endif
87 
88 /*#define CTLIB_VERSION	CS_VERSION_100 */
89 
90 #ifndef MAX
91 #define MAX(X,Y)	(((X) > (Y)) ? (X) : (Y))
92 #endif
93 
94 #ifndef MIN
95 #define MIN(X,Y)	(((X) < (Y)) ? (X) : (Y))
96 #endif
97 
98 
99 #if !defined(Sybase_h)
100 #define Sybase_h 1
101 
102 void     syb_init _((dbistate_t *dbistate));
103 
104 int      syb_discon_all _((SV *drh, imp_drh_t *imp_drh));
105 
106 int      syb_db_login _((SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *uid, char *pwd, SV *attribs));
107 int      syb_db_do _((SV *sv, char *statement));
108 int      syb_db_commit     _((SV *dbh, imp_dbh_t *imp_dbh));
109 int      syb_db_rollback   _((SV *dbh, imp_dbh_t *imp_dbh));
110 int      syb_db_disconnect _((SV *dbh, imp_dbh_t *imp_dbh));
111 void     syb_db_destroy    _((SV *dbh, imp_dbh_t *imp_dbh));
112 int      syb_db_STORE_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv));
113 SV      *syb_db_FETCH_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv));
114 
115 int      syb_st_prepare _((SV *sth, imp_sth_t *imp_sth,
116                 char *statement, SV *attribs));
117 int      syb_st_rows    _((SV *sth, imp_sth_t *imp_sth));
118 int      syb_st_execute _((SV *sth, imp_sth_t *imp_sth));
119 AV      *syb_st_fetch   _((SV *sth, imp_sth_t *imp_sth));
120 int      syb_st_finish  _((SV *sth, imp_sth_t *imp_sth));
121 void     syb_st_destroy _((SV *sth, imp_sth_t *imp_sth));
122 int      syb_st_blob_read _((SV *sth, imp_sth_t *imp_sth,
123                 int field, long offset, long len, SV *destrv, long destoffset));
124 int      syb_ct_get_data _((SV *sth, imp_sth_t *imp_sth,
125 			    int column, SV *bufrv, int buflen));
126 int      syb_ct_data_info _((SV *sth, imp_sth_t *imp_sth, int action,
127 			     int column, SV *attr));
128 int      syb_ct_send_data _((SV *sth, imp_sth_t *imp_sth, char *buffer,
129 			     int size));
130 int      syb_ct_prepare_send _((SV *sth, imp_sth_t *));
131 int      syb_ct_finish_send _((SV *sth, imp_sth_t *));
132 int      syb_st_STORE_attrib _((SV *sth, imp_sth_t *imp_sth, SV *keysv, SV *valuesv));
133 SV      *syb_st_FETCH_attrib _((SV *sth, imp_sth_t *imp_sth, SV *keysv));
134 
135 int      syb_describe _((SV *sth, imp_sth_t *imp_sth));
136 int      syb_bind_ph  _((SV *sth, imp_sth_t *imp_sth,
137                 SV *param, SV *value, IV sql_type, SV *attribs,
138 				int is_inout, IV maxlen));
139 
140 
141 /* prototypes for module-specific functions */
142 int      syb_thread_enabled _((void));
143 int      syb_set_timeout _((int timeout));
144 int      syb_db_date_fmt _((SV *, imp_dbh_t *, char *));
145 
146 SV *     syb_set_cslib_cb ( SV *cb);
147 
148 
149 #endif /* defined Sybase_h */
150 
151 /* end of Sybase.h */
152