~ubuntu-branches/debian/lenny/freetds/lenny

« back to all changes in this revision

Viewing changes to include/dblib.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2008-08-02 11:49:53 UTC
  • mfrom: (2.1.10 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802114953-0qdeowgl63k42n2c
Tags: 0.82-4
* Fix a typo in the freetds-common description, ugh
* Versioned replaces of libct4 by freetds-common, since the current one
  obviously doesn't have overlapping files.
* tdsodbc: check for /var/lib/odbc existence before removing it in the
  postinst, since there are cases where it won't exist on upgrade (i.e.,
  if the driver was never enabled in the first place).  Closes: #493303.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2
 
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
 
2
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  Brian Bruns
3
3
 *
4
4
 * This library is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU Library General Public
20
20
#ifndef _dblib_h_
21
21
#define _dblib_h_
22
22
 
 
23
#if defined(__GNUC__) && __GNUC__ >= 4
 
24
#pragma GCC visibility push(hidden)
 
25
#endif
 
26
 
23
27
#ifdef __cplusplus
24
28
extern "C"
25
29
{
28
32
#endif
29
33
#endif
30
34
 
31
 
static const char rcsid_dblib_h[] = "$Id: dblib.h,v 1.21.2.2 2005/01/06 01:51:17 jklowden Exp $";
32
 
static const void *const no_unused_dblib_h_warn[] = { rcsid_dblib_h, no_unused_dblib_h_warn };
 
35
/* $Id: dblib.h,v 1.43 2007/12/05 03:04:11 jklowden Exp $ */
33
36
 
34
37
enum {
35
38
          _DB_RES_INIT            = 0
45
48
        TDSLOGIN *tds_login;
46
49
};
47
50
 
 
51
struct dblib_buffer_row;
 
52
 
48
53
typedef struct tag_DBPROC_ROWBUF
49
54
{
50
 
        int buffering_on;       /* (boolean) is row buffering turned on?     */
51
 
        int first_in_buf;       /* result set row number of first row in buf */
52
 
        int next_row;           /* result set row number of next row         */
53
 
        int newest;             /* index of most recent item in queue        */
54
 
        int oldest;             /* index of least recent item in queue       */
55
 
        int elcount;            /* max element count that buffer can hold    */
56
 
        int element_size;       /* size in bytes of each element in queue    */
57
 
        int rows_in_buf;        /* # of rows currently in buffer             */
58
 
        void *rows;             /* pointer to the row storage                */
 
55
        int received;           /* how many rows have been received for this result set */
 
56
        int head;               /* queue insertion point */
 
57
        int tail;               /* oldest item in queue */
 
58
        int current;            /* dbnextrow() reads this row */
 
59
        int capacity;           /* how many elements the queue can hold  */
 
60
        struct dblib_buffer_row *rows;          /* pointer to the row storage */
59
61
} DBPROC_ROWBUF;
60
62
 
61
63
typedef struct
86
88
 
87
89
typedef struct
88
90
{
89
 
        char *hint;
 
91
        const char *hint;
90
92
        TDS_CHAR *tablename;
91
93
        TDS_CHAR *insert_stmt;
92
94
        TDS_INT direction;
120
122
        DBREMOTE_PROC_PARAM *param_list;
121
123
} DBREMOTE_PROC;
122
124
 
 
125
#define MAXOPTTEXT    32
 
126
 
 
127
struct dboption
 
128
{
 
129
        char text[MAXOPTTEXT];
 
130
        DBSTRING *param;
 
131
        DBBOOL factive;
 
132
};
 
133
typedef struct dboption DBOPTION;
 
134
 
 
135
typedef struct _null_representation
 
136
{
 
137
        const BYTE *bindval;
 
138
        size_t len;
 
139
} NULLREP;
 
140
 
123
141
struct tds_dblib_dbprocess
124
142
{
125
143
        TDSSOCKET *tds_socket;
148
166
        char dbcurdb[DBMAXNAME + 1];
149
167
        char servcharset[DBMAXNAME + 1];
150
168
        FILE *ftos;
151
 
        DB_DBCHKINTR_FUNC dbchkintr;
152
 
        DB_DBHNDLINTR_FUNC dbhndlintr;
 
169
        DB_DBCHKINTR_FUNC chkintr;
 
170
        DB_DBHNDLINTR_FUNC hndlintr;
153
171
        
154
172
        /** boolean use ms behaviour */
155
173
        int msdblib;
 
174
 
 
175
        int ntimeouts;
 
176
 
 
177
        /** default null values **/
 
178
        NULLREP         nullreps[MAXBINDTYPES];
156
179
};
157
180
 
158
 
#define DBLIB_INFO_MSG_TYPE 0
159
 
#define DBLIB_ERROR_MSG_TYPE 1
160
 
 
161
181
/*
162
 
** internal prototypes
163
 
*/
164
 
int _dblib_handle_info_message(TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
165
 
int _dblib_handle_err_message(TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
166
 
int _dblib_client_msg(DBPROCESS * dbproc, int dberr, int severity, const char *dberrstr);
 
182
 * internal prototypes
 
183
 */
 
184
int dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum, ...);
 
185
int _dblib_handle_info_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
 
186
int _dblib_handle_err_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
 
187
int _dblib_check_and_handle_interrupt(void * vdbproc);
 
188
 
167
189
void _dblib_setTDS_version(TDSLOGIN * tds_login, DBINT version);
168
190
 
169
191
DBINT _convert_char(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen);
170
192
DBINT _convert_intn(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen);
171
193
 
172
194
RETCODE _bcp_clear_storage(DBPROCESS * dbproc);
173
 
RETCODE _bcp_get_term_var(BYTE * dataptr, BYTE * term, int term_len);
174
195
RETCODE _bcp_get_prog_data(DBPROCESS * dbproc);
175
 
int _bcp_readfmt_colinfo(DBPROCESS * dbproc, char *buf, BCP_HOSTCOLINFO * ci);
176
 
RETCODE _bcp_read_hostfile(DBPROCESS * dbproc, FILE * hostfile, FILE * errfile, int *row_error);
177
196
 
178
197
extern MHANDLEFUNC _dblib_msg_handler;
179
198
extern EHANDLEFUNC _dblib_err_handler;
180
199
 
 
200
#define CHECK_PARAMETER(x, msg, ret)    if (!(x)) { dbperror(dbproc, (msg), 0); return ret; }
 
201
#define CHECK_DBPROC() CHECK_PARAMETER(dbproc, SYBENULL, FAIL)
 
202
#define CHECK_NULP(x, func, param_num, ret)     if (!(x)) { dbperror(dbproc, SYBENULP, 0, func, (int) param_num); return ret; }
 
203
#define CHECK_PARAMETER_NOPROC(x, msg)  if (!(x)) { dbperror(NULL, (msg), 0); return FAIL; }
 
204
#define DBPERROR_RETURN(x, msg) if (x) { dbperror(dbproc, (msg), 0); return FAIL; }
 
205
#define DBPERROR_RETURN3(x, msg, a, b, c)       if (x) { dbperror(dbproc, (msg), 0, a, b, c); return FAIL; }
 
206
 
 
207
 
181
208
#ifdef __cplusplus
182
209
#if 0
183
210
{
185
212
}
186
213
#endif
187
214
 
 
215
#if defined(__GNUC__) && __GNUC__ >= 4
 
216
#pragma GCC visibility pop
 
217
#endif
 
218
 
188
219
#endif