This file is indexed.

/usr/include/odbcss.h is in freetds-dev 1.00.82-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
 * Copyright (C) 2008  Frediano Ziglio
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef _odbcss_h_
#define _odbcss_h_

#ifdef TDSODBC_BCP
#include <sql.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define SQL_DIAG_SS_MSGSTATE	(-1150)
#define SQL_DIAG_SS_LINE	(-1154)

#define SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT  1233
#define SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT  1234
#define SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS  1235

#ifndef SQL_SS_LENGTH_UNLIMITED
#define SQL_SS_LENGTH_UNLIMITED 0
#endif

#ifndef SQL_COPT_SS_BASE
#define SQL_COPT_SS_BASE	1200
#endif

#ifndef SQL_COPT_SS_MARS_ENABLED
#define SQL_COPT_SS_MARS_ENABLED	(SQL_COPT_SS_BASE+24)
#endif

#ifndef SQL_COPT_SS_OLDPWD
#define SQL_COPT_SS_OLDPWD	(SQL_COPT_SS_BASE+26)
#endif

#define SQL_INFO_FREETDS_TDS_VERSION	1300

#ifndef SQL_MARS_ENABLED_NO
#define SQL_MARS_ENABLED_NO	0
#endif

#ifndef SQL_MARS_ENABLED_YES
#define SQL_MARS_ENABLED_YES	1
#endif

#ifndef SQL_SS_VARIANT
#define SQL_SS_VARIANT	(-150)
#endif

#ifndef SQL_SS_UDT
#define SQL_SS_UDT	(-151)
#endif

#ifndef SQL_SS_XML
#define SQL_SS_XML	(-152)
#endif

#ifndef SQL_SS_TABLE
#define SQL_SS_TABLE	(-153)
#endif

#ifndef SQL_SS_TIME2
#define SQL_SS_TIME2	(-154)
#endif

#ifndef SQL_SS_TIMESTAMPOFFSET
#define SQL_SS_TIMESTAMPOFFSET	(-155)
#endif

/*
 * these types are used from conversion from client to server
 */
#ifndef SQL_C_SS_TIME2
#define SQL_C_SS_TIME2	(0x4000)
#endif

#ifndef SQL_C_SS_TIMESTAMPOFFSET
#define SQL_C_SS_TIMESTAMPOFFSET	(0x4001)
#endif

#ifndef SQL_CA_SS_BASE
#define SQL_CA_SS_BASE 1200
#endif

#ifndef SQL_CA_SS_UDT_CATALOG_NAME
#define SQL_CA_SS_UDT_CATALOG_NAME	(SQL_CA_SS_BASE+18)
#endif

#ifndef SQL_CA_SS_UDT_SCHEMA_NAME
#define SQL_CA_SS_UDT_SCHEMA_NAME	(SQL_CA_SS_BASE+19)
#endif

#ifndef SQL_CA_SS_UDT_TYPE_NAME
#define SQL_CA_SS_UDT_TYPE_NAME	(SQL_CA_SS_BASE+20)
#endif

#ifndef SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME
#define SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME	(SQL_CA_SS_BASE+21)
#endif

#ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME
#define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME	(SQL_CA_SS_BASE+22)
#endif

#ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME
#define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME	(SQL_CA_SS_BASE+23)
#endif

#ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_NAME
#define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME	(SQL_CA_SS_BASE+24)
#endif

typedef struct tagSS_TIME2_STRUCT {
	SQLUSMALLINT hour;
	SQLUSMALLINT minute;
	SQLUSMALLINT second;
	SQLUINTEGER fraction;
} SQL_SS_TIME2_STRUCT;

typedef struct tagSS_TIMESTAMPOFFSET_STRUCT {
	SQLSMALLINT year;
	SQLUSMALLINT month;
	SQLUSMALLINT day;
	SQLUSMALLINT hour;
	SQLUSMALLINT minute;
	SQLUSMALLINT second;
	SQLUINTEGER fraction;
	SQLSMALLINT timezone_hour;
	SQLSMALLINT timezone_minute;
} SQL_SS_TIMESTAMPOFFSET_STRUCT;


#ifdef TDSODBC_BCP

#ifndef SUCCEED
#define SUCCEED 1
#endif
#ifndef FAIL
#define FAIL 0
#endif

#ifndef BCPKEEPIDENTITY
#define BCPKEEPIDENTITY 8
#endif
#ifndef BCPHINTS
#define BCPHINTS 6
#endif

#define BCP_DIRECTION_IN 1

#define SQL_COPT_SS_BCP	(SQL_COPT_SS_BASE+19)
#define SQL_BCP_OFF 0
#define SQL_BCP_ON 1

#define SQL_COPT_TDSODBC_IMPL_BASE	1500
#define SQL_COPT_TDSODBC_IMPL_BCP_INITA	(SQL_COPT_TDSODBC_IMPL_BASE)
#define SQL_COPT_TDSODBC_IMPL_BCP_CONTROL	(SQL_COPT_TDSODBC_IMPL_BASE+1)
#define SQL_COPT_TDSODBC_IMPL_BCP_COLPTR	(SQL_COPT_TDSODBC_IMPL_BASE+2)
#define SQL_COPT_TDSODBC_IMPL_BCP_SENDROW	(SQL_COPT_TDSODBC_IMPL_BASE+3)
#define SQL_COPT_TDSODBC_IMPL_BCP_BATCH	(SQL_COPT_TDSODBC_IMPL_BASE+4)
#define SQL_COPT_TDSODBC_IMPL_BCP_DONE	(SQL_COPT_TDSODBC_IMPL_BASE+5)
#define SQL_COPT_TDSODBC_IMPL_BCP_BIND	(SQL_COPT_TDSODBC_IMPL_BASE+6)
#define SQL_COPT_TDSODBC_IMPL_BCP_INITW	(SQL_COPT_TDSODBC_IMPL_BASE+7)

#define SQL_VARLEN_DATA -10

/* copied from sybdb.h which was copied from tds.h */
/* TODO find a much better way... */
enum
{
	BCP_TYPE_SQLCHAR = 47,		/* 0x2F */
#define BCP_TYPE_SQLCHAR	BCP_TYPE_SQLCHAR
	BCP_TYPE_SQLVARCHAR = 39,	/* 0x27 */
#define BCP_TYPE_SQLVARCHAR	BCP_TYPE_SQLVARCHAR
	BCP_TYPE_SQLINTN = 38,		/* 0x26 */
#define BCP_TYPE_SQLINTN	BCP_TYPE_SQLINTN
	BCP_TYPE_SQLINT1 = 48,		/* 0x30 */
#define BCP_TYPE_SQLINT1	BCP_TYPE_SQLINT1
	BCP_TYPE_SQLINT2 = 52,		/* 0x34 */
#define BCP_TYPE_SQLINT2	BCP_TYPE_SQLINT2
	BCP_TYPE_SQLINT4 = 56,		/* 0x38 */
#define BCP_TYPE_SQLINT4	BCP_TYPE_SQLINT4
	BCP_TYPE_SQLINT8 = 127,		/* 0x7F */
#define BCP_TYPE_SQLINT8	BCP_TYPE_SQLINT8
	BCP_TYPE_SQLFLT8 = 62,		/* 0x3E */
#define BCP_TYPE_SQLFLT8	BCP_TYPE_SQLFLT8
	BCP_TYPE_SQLDATETIME = 61,	/* 0x3D */
#define BCP_TYPE_SQLDATETIME	BCP_TYPE_SQLDATETIME
	BCP_TYPE_SQLBIT = 50,		/* 0x32 */
#define BCP_TYPE_SQLBIT	BCP_TYPE_SQLBIT
	BCP_TYPE_SQLBITN = 104,		/* 0x68 */
#define BCP_TYPE_SQLBITN	BCP_TYPE_SQLBITN
	BCP_TYPE_SQLTEXT = 35,		/* 0x23 */
#define BCP_TYPE_SQLTEXT	BCP_TYPE_SQLTEXT
	BCP_TYPE_SQLNTEXT = 99,		/* 0x63 */
#define BCP_TYPE_SQLNTEXT	BCP_TYPE_SQLNTEXT
	BCP_TYPE_SQLIMAGE = 34,		/* 0x22 */
#define BCP_TYPE_SQLIMAGE	BCP_TYPE_SQLIMAGE
	BCP_TYPE_SQLMONEY4 = 122,	/* 0x7A */
#define BCP_TYPE_SQLMONEY4	BCP_TYPE_SQLMONEY4
	BCP_TYPE_SQLMONEY = 60,		/* 0x3C */
#define BCP_TYPE_SQLMONEY	BCP_TYPE_SQLMONEY
	BCP_TYPE_SQLDATETIME4 = 58,	/* 0x3A */
#define BCP_TYPE_SQLDATETIME4	BCP_TYPE_SQLDATETIME4
	BCP_TYPE_SQLREAL = 59,		/* 0x3B */
	BCP_TYPE_SQLFLT4 = 59,		/* 0x3B */
#define BCP_TYPE_SQLREAL	BCP_TYPE_SQLREAL
#define BCP_TYPE_SQLFLT4	BCP_TYPE_SQLFLT4
	BCP_TYPE_SQLBINARY = 45,		/* 0x2D */
#define BCP_TYPE_SQLBINARY	BCP_TYPE_SQLBINARY
	BCP_TYPE_SQLVOID = 31,		/* 0x1F */
#define BCP_TYPE_SQLVOID	BCP_TYPE_SQLVOID
	BCP_TYPE_SQLVARBINARY = 37,	/* 0x25 */
#define BCP_TYPE_SQLVARBINARY	BCP_TYPE_SQLVARBINARY
	BCP_TYPE_SQLNUMERIC = 108,	/* 0x6C */
#define BCP_TYPE_SQLNUMERIC	BCP_TYPE_SQLNUMERIC
	BCP_TYPE_SQLDECIMAL = 106,	/* 0x6A */
#define BCP_TYPE_SQLDECIMAL	BCP_TYPE_SQLDECIMAL
	BCP_TYPE_SQLFLTN = 109,		/* 0x6D */
#define BCP_TYPE_SQLFLTN	BCP_TYPE_SQLFLTN
	BCP_TYPE_SQLMONEYN = 110,	/* 0x6E */
#define BCP_TYPE_SQLMONEYN	BCP_TYPE_SQLMONEYN
	BCP_TYPE_SQLDATETIMN = 111,	/* 0x6F */
#define BCP_TYPE_SQLDATETIMN	BCP_TYPE_SQLDATETIMN
	BCP_TYPE_SQLNVARCHAR = 103,	/* 0x67 */
#define BCP_TYPE_SQLNVARCHAR	BCP_TYPE_SQLNVARCHAR
	BCP_TYPE_SQLUNIQUEID = 36,	/* 0x24 */
#define BCP_TYPE_SQLUNIQUEID	BCP_TYPE_SQLUNIQUEID
	BCP_TYPE_SQLDATETIME2 = 42,    /* 0x2a */
#define BCP_TYPE_SQLDATETIME2	BCP_TYPE_SQLDATETIME2
};

typedef struct
{
	int dtdays;
	int dttime;
} DBDATETIME;

#ifdef _MSC_VER
#define TDSODBC_INLINE __inline
#else
#define TDSODBC_INLINE __inline__
#endif

struct tdsodbc_impl_bcp_init_params
{
	const void *tblname;
	const void *hfile;
	const void *errfile;
	int direction;
};

static TDSODBC_INLINE RETCODE SQL_API
bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction)
{
	struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITA, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

static TDSODBC_INLINE RETCODE SQL_API
bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction)
{
	struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITW, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

struct tdsodbc_impl_bcp_control_params
{
	int field;
	void *value;
};

static TDSODBC_INLINE RETCODE SQL_API
bcp_control(HDBC hdbc, int field, void *value)
{
	struct tdsodbc_impl_bcp_control_params params = {field, value};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_CONTROL, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

struct tdsodbc_impl_bcp_colptr_params
{
	const unsigned char * colptr;
	int table_column;
};

static TDSODBC_INLINE RETCODE SQL_API
bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column)
{
	struct tdsodbc_impl_bcp_colptr_params params = {colptr, table_column};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_COLPTR, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

static TDSODBC_INLINE RETCODE SQL_API
bcp_sendrow(HDBC hdbc)
{
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_SENDROW, NULL, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

struct tdsodbc_impl_bcp_batch_params
{
	int rows;
};

static TDSODBC_INLINE int SQL_API
bcp_batch(HDBC hdbc)
{
	struct tdsodbc_impl_bcp_batch_params params = {-1};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BATCH, &params, SQL_IS_POINTER)) ? params.rows : -1;
}

struct tdsodbc_impl_bcp_done_params
{
	int rows;
};

static TDSODBC_INLINE int SQL_API
bcp_done(HDBC hdbc)
{
	struct tdsodbc_impl_bcp_done_params params = {-1};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_DONE, &params, SQL_IS_POINTER)) ? params.rows : -1;
}

struct tdsodbc_impl_bcp_bind_params
{
	const unsigned char * varaddr;
	int prefixlen;
	int varlen;
	const unsigned char * terminator;
	int termlen;
	int vartype;
	int table_column;
};

static TDSODBC_INLINE RETCODE SQL_API
bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen,
	const unsigned char * terminator, int termlen, int vartype, int table_column)
{
	struct tdsodbc_impl_bcp_bind_params params = {varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column};
	return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BIND, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
}

#ifdef UNICODE
#define bcp_init bcp_initW
#else
#define bcp_init bcp_initA
#endif

#endif /* TDSODBC_BCP */

#ifdef __cplusplus
}
#endif

#endif /* _odbcss_h_ */