File: odbcinc.h

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (178 lines) | stat: -rw-r--r-- 5,535 bytes parent folder | download | duplicates (2)
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
/*
 *  odbcinc.h
 *
 *  $Id$
 *
 *  Include the ODBC header, whichever appropriate
 *
 *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 *  project.
 *
 *  Copyright (C) 1998-2012 OpenLink Software
 *
 *  This project is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; only version 2 of the License, dated June 1991.
 *
 *  This program 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
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#ifndef __V_ODBCINC_H
#define __V_ODBCINC_H

#if defined(HAVE_CONFIG_H) && !defined(_CONFIG_H)
#define _CONFIG_H
# include "config.h"
#endif

#if (defined (WIN32) || defined (UNIX_ODBC)) && !defined (UDBC)
# include "Dk.h"
# ifdef WIN32
#  include <windows.h>
# endif
# include <sql.h>
# include <sqlext.h>
# include <sqlucode.h>
# if defined (WIN32)
#  include <odbcinst.h>
#  define ERR_STRING	"[OpenLink][Virtuoso ODBC Driver]"
# else
#  define ERR_STRING	"[OpenLink][Virtuoso iODBC Driver]"
# endif

# ifndef SQL_COPT_SS_BASE
#  define SQL_COPT_SS_BASE		1200
#  define SQL_COPT_SS_ENLIST_IN_DTC	(SQL_COPT_SS_BASE+7)
#  define SQL_COPT_SS_ENLIST_IN_XA	(SQL_COPT_SS_BASE+8)
# endif

# if defined (WIN32)
#  ifndef HAVE_ODBCINST_H
#   define HAVE_ODBCINST_H
#  endif
# else
#  ifdef NO_UDBC_SDK
#   include <iodbcinst.h>
#   define HAVE_ODBCINST_H
#  else
#   include "iodbcinst.h"
#  endif
# endif

#else /* unix */
# define ERR_STRING	"[Virtuoso Driver]"
# include <sql.h>
# include <sqlext.h>
# include <iodbcext.h>
# ifndef NO_UDBC_SDK
typedef SQLCHAR SQLTCHAR;
#  if !defined (__ODBC3_DEFINES) && (ODBCVER < 0x0300)
#   define __ODBC3_DEFINES 1
typedef void * SQLHANDLE;
#   define SQL_TYPE_DATE 91
#   define SQL_TYPE_TIME 92
#   define SQL_TYPE_TIMESTAMP 93
#   define SQL_PARAM_SUCCESS	0
#   define SQL_PARAM_ERROR		5
#   define SQL_PARAM_SUCCESS_WITH_INFO	6
#   define SQL_PARAM_UNUSED	7

#  endif /* __ODBC3_DEFINES */
# endif /* NO_UDBC_SDK */
#endif /* UNIX */

/* these are from sqlucode.h */
#ifndef SQL_WCHAR
#  define SQL_WCHAR		(-8)
#  define SQL_C_WCHAR		SQL_WCHAR
#endif

#ifndef SQL_WVARCHAR
#  define SQL_WVARCHAR		(-9)
#  define SQL_C_WVARCHAR 	SQL_WVARCHAR
#endif

#ifndef SQL_WLONGVARCHAR
#  define SQL_WLONGVARCHAR	(-10)
#  define SQL_C_WLONGVARCHAR	SQL_WLONGVARCHAR
#endif

#ifndef SQL_FN_CVT_CAST
#  define SQL_FN_CVT_CAST	0x00000002L
#endif

/* from iodbcext.h */
#ifndef SQL_GETLASTSERIAL
#define SQL_GETLASTSERIAL 1049L
#endif


#ifndef WIN32
#ifndef SQLLEN
#define SQLLEN SDWORD
#endif
#ifndef SQLULEN
#define SQLULEN UDWORD
#endif
#ifndef SQLSETPOSIROW
#define SQLSETPOSIROW SQLUSMALLINT
#endif
#endif

#define IS_INTERSOLV(drvr_name) (drvr_name[0] == 'I' && drvr_name[1] == 'V')
#define IS_ORACLE(rcon) (strindex (rcon->rc_dbms, "Oracle"))
#define IS_SQLSERVER(rcon) (strstr (rcon->rc_dbms, "SQL Server") || strstr (rcon->rc_dbms, "S Q L   S e r v e r"))
#define IS_SQLSERVER_RDS(rds) (strstr (rds_get_info (rds, SQL_DBMS_NAME), "SQL Server") || strstr (rds_get_info (rds, SQL_DBMS_NAME), "S Q L   S e r v e r"))
#define IS_SYBASE_RDS(rds) \
		( \
		  (strstr (rds_get_info (rds, SQL_DBMS_NAME), "SQL Server") || \
		   strstr (rds_get_info (rds, SQL_DBMS_NAME), "Sybase 11 (ctlib)") || \
		   strstr (rds_get_info (rds, SQL_DBMS_NAME), "S Q L   S e r v e r") \
		  ) && \
		  !(strstr (rds_get_info (rds, SQL_DBMS_NAME), "Microsoft") || \
		   strstr (rds_get_info (rds, SQL_DBMS_NAME), "M i c r o s o f t") || \
		   strstr (rds_get_info (rds, SQL_DBMS_NAME), "MS SQL Server") \
		  ) \
		)
#define IS_VIRTUOSO_RDS(rds) (strstr (rds_get_info (rds, SQL_DBMS_NAME), "Virtuoso") != NULL)
#define IS_VIASERV_RDS(rds) ( \
		  (strstr (rds_get_info (rds, SQL_DBMS_NAME), "ViaSQL")) || \
 		  (!strcmp (rds_get_info (rds, SQL_DBMS_NAME), "LDS")) || \
		  (strstr (rds_get_info (rds, SQL_DRIVER_VER), "ViaSQL")) \
		)
#define IS_ORACLE_RDS(rds) (strindex (rds_get_info (rds, SQL_DBMS_NAME), "Oracle"))
#define IS_INFORMIX_RDS(rds) (nc_strstr ((unsigned char *) rds_get_info (rds, SQL_DBMS_NAME), (unsigned char *) "Informix") != NULL)
#define IS_PROGRESS_RDS(rds) (nc_strstr ((unsigned char *) rds_get_info (rds, SQL_DBMS_NAME), (unsigned char *) "Progress") != NULL)
#define SHOULD_USE_SCROLLABLE(rcon) (IS_SQLSERVER (rcon))
#define SHOULD_USE_SCROLLABLE_RDS(rds) (IS_SQLSERVER_RDS (rds))

#define IS_ORACLE_NATIVE_RDS(rds) (IS_ORACLE_RDS(rds) && \
    ((0 == strncmp(rds_get_info (rds, SQL_DRIVER_NAME),"SQORA", 5)) || \
     (0 == strncmp(rds_get_info (rds, SQL_DRIVER_NAME),"SQOCI", 5))))

#define IS_ORACLE_NATIVE_DRIVER(rcon) (IS_ORACLE(rcon) && \
    ((0 == strncmp(rcon->rc_driver_name, "SQORA", 5)) || \
     (0 == strncmp(rcon->rc_driver_name, "SQOCI", 5))))
#endif


/*
 * Added extensions for retrieving RDF literal/type  meta data
 * through ODBC interface
 */
#ifndef SQL_DESC_COL_DV_TYPE
#define SQL_DESC_COL_DV_TYPE           1057L
#define SQL_DESC_COL_DT_DT_TYPE        1058L
#define SQL_DESC_COL_LITERAL_ATTR      1059L
#define SQL_DESC_COL_BOX_FLAGS         1060L
#define SQL_DESC_COL_LITERAL_LANG      1061L
#define SQL_DESC_COL_LITERAL_TYPE      1062L
#endif