-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathodbc_portable.h
138 lines (111 loc) · 3.83 KB
/
odbc_portable.h
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
/*
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
*/
#ifndef __ODBC_PORTABLE_HEADER
#define __ODBC_PORTABLE_HEADER
#if defined (_WINDOWS)
#include "windows.h"
#else
#define CUBRID_LINUX_ODBC
#include <wchar.h>
#include <stdint.h>
#endif
#include "sqlext.h"
#define ODBC_INTERFACE
#define PUBLIC
#define PRIVATE static
#ifndef BUF_SIZE
#define BUF_SIZE 1024
#endif
#define ITEMBUFLEN 128
#define NAMEBUFLEN 128
#define VALUEBUFLEN 256
#define ERR_CODE short
#define _BOOL_ short
#define _TRUE_ 1
#define _FALSE_ 0
#define _OK_ 0
#define _ERROR_ (-1)
#define ERROR_RETURN(err) if ( err < 0 ) return err;
#define ERROR_GOTO(err, label) if ( err < 0 ) goto label;
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
#if defined (CUBRID_LINUX_ODBC)
typedef int64_t __int64;
typedef int INT_PTR;
typedef unsigned int * UINT_PTR;
typedef const char * LPCTSTR;
typedef long LONG_PTR;
typedef LONG_PTR LPARAM;
typedef UINT_PTR WPARAM;
typedef WCHAR OLECHAR;
#define _stricmp strcasecmp
#define _strnicmp strncasecmp
#define stricmp strcasecmp
#define _atoi64 atoll
#define _snprintf snprintf
#define CP_EUC_KR 51949
#define CP_ACP 949 /* code page 949 is KSC5601 */
#define CP_UTF8 65001
#define CP_UTF7 65000
#if !defined (_MAX_PATH)
#define _MAX_PATH 4096
#endif
#if !defined (TRUE)
typedef enum { TRUE = 1, FALSE = 0 } bool;
#endif
#endif
/* Handle Management */
#define INIT 0
#define RESET 1
#define FREE_MEMBER 2
#define FREE_ALL 3
/* CUBRID ODBC extension */
#define ODBC_SUCCESS SQL_SUCCESS
#define ODBC_SUCCESS_WITH_INFO SQL_SUCCESS_WITH_INFO
#define ODBC_ERROR SQL_ERROR
#define ODBC_NO_DATA SQL_NO_DATA
#define ODBC_NEED_DATA SQL_NEED_DATA
#define ODBC_INVALID_HANDLE SQL_INVALID_HANDLE
#define ODBC_NTS SQL_NTS
#define ODBC_ROW_DELETED (-101)
#if (ODBCVER >= 0x300)
#define SQL_IS_BINARY (-9)
#define SQL_IS_STRING (-10)
#define SQL_POINTER 21
#define SQL_C_POINTER SQL_POINTER
#define SQL_STRING 22
#define SQL_C_STRING SQL_STRING
#define SQL_TYPE_EMPTY 23
#define SQL_C_TYPE_EMPTY SQL_TYPE_EMPTY
#endif
#define ODBC_STRLEN_IND(value) ((value == NULL) ? SQL_NULL_DATA : strlen(value))
#define strlen(s) ((int) strlen(s))
extern PUBLIC HINSTANCE hInstance;
#endif /* ! __ODBC_PORTABLE_HEADER */