cubrid 0.65 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/ext/build_cci.sh +19 -0
- data/ext/cci.bz2 +0 -0
- data/ext/conn.c +57 -39
- data/ext/cubrid.c +194 -197
- data/ext/cubrid.h +122 -98
- data/ext/error.c +151 -144
- data/ext/extconf.rb +52 -19
- data/ext/stmt.c +1012 -1019
- metadata +28 -31
- checksums.yaml +0 -7
data/ext/cubrid.h
CHANGED
@@ -1,98 +1,122 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
|
3
|
-
*
|
4
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
5
|
-
* are permitted provided that the following conditions are met:
|
6
|
-
*
|
7
|
-
* - Redistributions of source code must retain the above copyright notice,
|
8
|
-
* this list of conditions and the following disclaimer.
|
9
|
-
*
|
10
|
-
* - Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
* this list of conditions and the following disclaimer in the documentation
|
12
|
-
* and/or other materials provided with the distribution.
|
13
|
-
*
|
14
|
-
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
|
15
|
-
* may be used to endorse or promote products derived from this software without
|
16
|
-
* specific prior written permission.
|
17
|
-
*
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
21
|
-
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
22
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
23
|
-
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
24
|
-
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
27
|
-
* OF SUCH DAMAGE.
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
|
31
|
-
#ifdef _WINDOWS
|
32
|
-
#pragma warning(disable:4312) /* type corecing */
|
33
|
-
#endif
|
34
|
-
|
35
|
-
#include "ruby.h"
|
36
|
-
#include "cas_cci.h"
|
37
|
-
|
38
|
-
#define MAX_STR_LEN 255
|
39
|
-
|
40
|
-
#define CUBRID_ER_INVALID_SQL_TYPE -2002
|
41
|
-
#define CUBRID_ER_CANNOT_GET_COLUMN_INFO -2003
|
42
|
-
#define CUBRID_ER_INIT_ARRAY_FAIL -2004
|
43
|
-
#define CUBRID_ER_UNKNOWN_TYPE -2005
|
44
|
-
#define CUBRID_ER_INVALID_PARAM -2006
|
45
|
-
#define CUBRID_ER_INVALID_ARRAY_TYPE -2007
|
46
|
-
#define CUBRID_ER_NOT_SUPPORTED_TYPE -2008
|
47
|
-
#define CUBRID_ER_OPEN_FILE -2009
|
48
|
-
#define CUBRID_ER_CREATE_TEMP_FILE -2010
|
49
|
-
#define CUBRID_ER_TRANSFER_FAIL -2011
|
50
|
-
|
51
|
-
typedef struct {
|
52
|
-
int handle;
|
53
|
-
char host[MAX_STR_LEN];
|
54
|
-
int port;
|
55
|
-
char db[MAX_STR_LEN];
|
56
|
-
char user[MAX_STR_LEN];
|
57
|
-
VALUE auto_commit;
|
58
|
-
} Connection;
|
59
|
-
|
60
|
-
typedef struct {
|
61
|
-
Connection *con;
|
62
|
-
int handle;
|
63
|
-
int affected_rows;
|
64
|
-
int col_count;
|
65
|
-
int param_cnt;
|
66
|
-
T_CCI_SQLX_CMD sql_type;
|
67
|
-
T_CCI_COL_INFO *col_info;
|
68
|
-
int bound;
|
69
|
-
} Statement;
|
70
|
-
|
71
|
-
typedef struct {
|
72
|
-
Connection *con;
|
73
|
-
char oid_str[MAX_STR_LEN];
|
74
|
-
int col_count;
|
75
|
-
VALUE col_type;
|
76
|
-
VALUE hash;
|
77
|
-
} Oid;
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
#
|
82
|
-
#define
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
#
|
91
|
-
#define
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
|
3
|
+
*
|
4
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
* are permitted provided that the following conditions are met:
|
6
|
+
*
|
7
|
+
* - Redistributions of source code must retain the above copyright notice,
|
8
|
+
* this list of conditions and the following disclaimer.
|
9
|
+
*
|
10
|
+
* - Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
* this list of conditions and the following disclaimer in the documentation
|
12
|
+
* and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
|
15
|
+
* may be used to endorse or promote products derived from this software without
|
16
|
+
* specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
21
|
+
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
22
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
23
|
+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
24
|
+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
27
|
+
* OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
|
31
|
+
#ifdef _WINDOWS
|
32
|
+
#pragma warning(disable:4312) /* type corecing */
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#include "ruby.h"
|
36
|
+
#include "cas_cci.h"
|
37
|
+
|
38
|
+
#define MAX_STR_LEN 255
|
39
|
+
|
40
|
+
#define CUBRID_ER_INVALID_SQL_TYPE -2002
|
41
|
+
#define CUBRID_ER_CANNOT_GET_COLUMN_INFO -2003
|
42
|
+
#define CUBRID_ER_INIT_ARRAY_FAIL -2004
|
43
|
+
#define CUBRID_ER_UNKNOWN_TYPE -2005
|
44
|
+
#define CUBRID_ER_INVALID_PARAM -2006
|
45
|
+
#define CUBRID_ER_INVALID_ARRAY_TYPE -2007
|
46
|
+
#define CUBRID_ER_NOT_SUPPORTED_TYPE -2008
|
47
|
+
#define CUBRID_ER_OPEN_FILE -2009
|
48
|
+
#define CUBRID_ER_CREATE_TEMP_FILE -2010
|
49
|
+
#define CUBRID_ER_TRANSFER_FAIL -2011
|
50
|
+
|
51
|
+
typedef struct {
|
52
|
+
int handle;
|
53
|
+
char host[MAX_STR_LEN];
|
54
|
+
int port;
|
55
|
+
char db[MAX_STR_LEN];
|
56
|
+
char user[MAX_STR_LEN];
|
57
|
+
VALUE auto_commit;
|
58
|
+
} Connection;
|
59
|
+
|
60
|
+
typedef struct {
|
61
|
+
Connection *con;
|
62
|
+
int handle;
|
63
|
+
int affected_rows;
|
64
|
+
int col_count;
|
65
|
+
int param_cnt;
|
66
|
+
T_CCI_SQLX_CMD sql_type;
|
67
|
+
T_CCI_COL_INFO *col_info;
|
68
|
+
int bound;
|
69
|
+
} Statement;
|
70
|
+
|
71
|
+
typedef struct {
|
72
|
+
Connection *con;
|
73
|
+
char oid_str[MAX_STR_LEN];
|
74
|
+
int col_count;
|
75
|
+
VALUE col_type;
|
76
|
+
VALUE hash;
|
77
|
+
} Oid;
|
78
|
+
|
79
|
+
#ifdef MS_WINDOWS
|
80
|
+
#define CUBRID_LONG_LONG _int64
|
81
|
+
#else
|
82
|
+
#define CUBRID_LONG_LONG long long
|
83
|
+
#endif
|
84
|
+
|
85
|
+
//ifndef CCI_ER_END
|
86
|
+
//#define CCI_ER_END (-20100)
|
87
|
+
//#endif
|
88
|
+
|
89
|
+
|
90
|
+
#ifndef RSTRING_PTR
|
91
|
+
#define RSTRING_PTR(str) RSTRING(str)->ptr
|
92
|
+
#endif
|
93
|
+
|
94
|
+
#ifndef RSTRING_LEN
|
95
|
+
#define RSTRING_LEN(str) RSTRING(str)->len
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#ifndef HAVE_RB_STR_SET_LEN
|
99
|
+
#define rb_str_set_len(str, length) (RSTRING_LEN(str) = (length))
|
100
|
+
#endif
|
101
|
+
|
102
|
+
VALUE GeteCubrid();
|
103
|
+
extern void cubrid_handle_error(int e, T_CCI_ERROR *error);
|
104
|
+
|
105
|
+
#define GET_CONN_STRUCT(self, con) Data_Get_Struct((self), Connection, (con))
|
106
|
+
#define CHECK_CONNECTION(con, rtn) \
|
107
|
+
do { \
|
108
|
+
if (!((con)->handle)) { \
|
109
|
+
cubrid_handle_error(CCI_ER_CON_HANDLE, NULL); \
|
110
|
+
return (rtn); \
|
111
|
+
} \
|
112
|
+
} while(0)
|
113
|
+
|
114
|
+
#define GET_STMT_STRUCT(self, stmt) Data_Get_Struct((self), Statement, (stmt))
|
115
|
+
#define CHECK_HANDLE(stmt, rtn) \
|
116
|
+
do { \
|
117
|
+
if (!((stmt)->handle)) { \
|
118
|
+
cubrid_handle_error(CCI_ER_REQ_HANDLE, NULL); \
|
119
|
+
return (rtn); \
|
120
|
+
} \
|
121
|
+
} while(0)
|
122
|
+
|
data/ext/error.c
CHANGED
@@ -1,144 +1,151 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
|
3
|
-
*
|
4
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
5
|
-
* are permitted provided that the following conditions are met:
|
6
|
-
*
|
7
|
-
* - Redistributions of source code must retain the above copyright notice,
|
8
|
-
* this list of conditions and the following disclaimer.
|
9
|
-
*
|
10
|
-
* - Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
* this list of conditions and the following disclaimer in the documentation
|
12
|
-
* and/or other materials provided with the distribution.
|
13
|
-
*
|
14
|
-
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
|
15
|
-
* may be used to endorse or promote products derived from this software without
|
16
|
-
* specific prior written permission.
|
17
|
-
*
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
21
|
-
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
22
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
23
|
-
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
24
|
-
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
27
|
-
* OF SUCH DAMAGE.
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
|
31
|
-
#include "cubrid.h"
|
32
|
-
|
33
|
-
static struct _error_message {
|
34
|
-
int err;
|
35
|
-
char* msg;
|
36
|
-
} cubrid_err_msgs[] = {
|
37
|
-
{-1, "CUBRID database error"},
|
38
|
-
{-2, "Invalid connection handle"},
|
39
|
-
{-3, "Memory allocation error"},
|
40
|
-
{-4, "Communication error"},
|
41
|
-
{-5, "No more data"},
|
42
|
-
{-6, "Unknown transaction type"},
|
43
|
-
{-7, "Invalid string parameter"},
|
44
|
-
{-8, "Type conversion error"},
|
45
|
-
{-9, "Parameter binding error"},
|
46
|
-
{-10, "Invalid type"},
|
47
|
-
{-11, "Parameter binding error"},
|
48
|
-
{-12, "Invalid database parameter name"},
|
49
|
-
{-13, "Invalid column index"},
|
50
|
-
{-14, "Invalid schema type"},
|
51
|
-
{-15, "File open error"},
|
52
|
-
{-16, "Connection error"},
|
53
|
-
{-17, "Connection handle creation error"},
|
54
|
-
{-18, "Invalid request handle"},
|
55
|
-
{-19, "Invalid cursor position"},
|
56
|
-
{-20, "Object is not valid"},
|
57
|
-
{-21, "CAS error"},
|
58
|
-
{-22, "Unknown host name"},
|
59
|
-
{-99, "Not implemented"},
|
60
|
-
{-1000, "Database connection error"},
|
61
|
-
{-1002, "Memory allocation error"},
|
62
|
-
{-1003, "Communication error"},
|
63
|
-
{-1004, "Invalid argument"},
|
64
|
-
{-1005, "Unknown transaction type"},
|
65
|
-
{-1007, "Parameter binding error"},
|
66
|
-
{-1008, "Parameter binding error"},
|
67
|
-
{-1009, "Cannot make DB_VALUE"},
|
68
|
-
{-1010, "Type conversion error"},
|
69
|
-
{-1011, "Invalid database parameter name"},
|
70
|
-
{-1012, "No more data"},
|
71
|
-
{-1013, "Object is not valid"},
|
72
|
-
{-1014, "File open error"},
|
73
|
-
{-1015, "Invalid schema type"},
|
74
|
-
{-1016, "Version mismatch"},
|
75
|
-
{-1017, "Cannot process the request. Try again later."},
|
76
|
-
{-1018, "Authorization error"},
|
77
|
-
{-1020, "The attribute domain must be the set type."},
|
78
|
-
{-1021, "The domain of a set must be the same data type."},
|
79
|
-
{-2001, "Memory allocation error"},
|
80
|
-
{-2002, "Invalid API call"},
|
81
|
-
{-2003, "Cannot get column info"},
|
82
|
-
{-2004, "Array initializing error"},
|
83
|
-
{-2005, "Unknown column type"},
|
84
|
-
{-2006, "Invalid parameter"},
|
85
|
-
{-2007, "Invalid array type"},
|
86
|
-
{-2008, "Invalid type"},
|
87
|
-
{-2009, "File open error"},
|
88
|
-
{-2010, "Temporary file open error"},
|
89
|
-
{-2011, "Glo transfering error"},
|
90
|
-
{0, "Unknown Error"}
|
91
|
-
};
|
92
|
-
|
93
|
-
static char *
|
94
|
-
get_error_msg(int err_code)
|
95
|
-
{
|
96
|
-
int i;
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
char
|
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
|
-
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
|
3
|
+
*
|
4
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
* are permitted provided that the following conditions are met:
|
6
|
+
*
|
7
|
+
* - Redistributions of source code must retain the above copyright notice,
|
8
|
+
* this list of conditions and the following disclaimer.
|
9
|
+
*
|
10
|
+
* - Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
* this list of conditions and the following disclaimer in the documentation
|
12
|
+
* and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
|
15
|
+
* may be used to endorse or promote products derived from this software without
|
16
|
+
* specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
21
|
+
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
22
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
23
|
+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
24
|
+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
27
|
+
* OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
|
31
|
+
#include "cubrid.h"
|
32
|
+
|
33
|
+
static struct _error_message {
|
34
|
+
int err;
|
35
|
+
char* msg;
|
36
|
+
} cubrid_err_msgs[] = {
|
37
|
+
{-1, "CUBRID database error"},
|
38
|
+
{-2, "Invalid connection handle"},
|
39
|
+
{-3, "Memory allocation error"},
|
40
|
+
{-4, "Communication error"},
|
41
|
+
{-5, "No more data"},
|
42
|
+
{-6, "Unknown transaction type"},
|
43
|
+
{-7, "Invalid string parameter"},
|
44
|
+
{-8, "Type conversion error"},
|
45
|
+
{-9, "Parameter binding error"},
|
46
|
+
{-10, "Invalid type"},
|
47
|
+
{-11, "Parameter binding error"},
|
48
|
+
{-12, "Invalid database parameter name"},
|
49
|
+
{-13, "Invalid column index"},
|
50
|
+
{-14, "Invalid schema type"},
|
51
|
+
{-15, "File open error"},
|
52
|
+
{-16, "Connection error"},
|
53
|
+
{-17, "Connection handle creation error"},
|
54
|
+
{-18, "Invalid request handle"},
|
55
|
+
{-19, "Invalid cursor position"},
|
56
|
+
{-20, "Object is not valid"},
|
57
|
+
{-21, "CAS error"},
|
58
|
+
{-22, "Unknown host name"},
|
59
|
+
{-99, "Not implemented"},
|
60
|
+
{-1000, "Database connection error"},
|
61
|
+
{-1002, "Memory allocation error"},
|
62
|
+
{-1003, "Communication error"},
|
63
|
+
{-1004, "Invalid argument"},
|
64
|
+
{-1005, "Unknown transaction type"},
|
65
|
+
{-1007, "Parameter binding error"},
|
66
|
+
{-1008, "Parameter binding error"},
|
67
|
+
{-1009, "Cannot make DB_VALUE"},
|
68
|
+
{-1010, "Type conversion error"},
|
69
|
+
{-1011, "Invalid database parameter name"},
|
70
|
+
{-1012, "No more data"},
|
71
|
+
{-1013, "Object is not valid"},
|
72
|
+
{-1014, "File open error"},
|
73
|
+
{-1015, "Invalid schema type"},
|
74
|
+
{-1016, "Version mismatch"},
|
75
|
+
{-1017, "Cannot process the request. Try again later."},
|
76
|
+
{-1018, "Authorization error"},
|
77
|
+
{-1020, "The attribute domain must be the set type."},
|
78
|
+
{-1021, "The domain of a set must be the same data type."},
|
79
|
+
{-2001, "Memory allocation error"},
|
80
|
+
{-2002, "Invalid API call"},
|
81
|
+
{-2003, "Cannot get column info"},
|
82
|
+
{-2004, "Array initializing error"},
|
83
|
+
{-2005, "Unknown column type"},
|
84
|
+
{-2006, "Invalid parameter"},
|
85
|
+
{-2007, "Invalid array type"},
|
86
|
+
{-2008, "Invalid type"},
|
87
|
+
{-2009, "File open error"},
|
88
|
+
{-2010, "Temporary file open error"},
|
89
|
+
{-2011, "Glo transfering error"},
|
90
|
+
{0, "Unknown Error"}
|
91
|
+
};
|
92
|
+
|
93
|
+
static char *
|
94
|
+
get_error_msg(int err_code)
|
95
|
+
{
|
96
|
+
int i = 0;
|
97
|
+
int len = (sizeof(cubrid_err_msgs) / sizeof(cubrid_err_msgs[0]));
|
98
|
+
|
99
|
+
for(i = 0;i<len; i++) {
|
100
|
+
if (cubrid_err_msgs[i].err == err_code) {
|
101
|
+
return cubrid_err_msgs[i].msg;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
return NULL;
|
105
|
+
}
|
106
|
+
|
107
|
+
void
|
108
|
+
cubrid_handle_error(int e, T_CCI_ERROR *error)
|
109
|
+
{
|
110
|
+
int err_code;
|
111
|
+
char msg[1024]={0};
|
112
|
+
char buf[128] ={0};
|
113
|
+
char *err_msg = NULL, *facility_msg;
|
114
|
+
|
115
|
+
if (e == CCI_ER_DBMS) {
|
116
|
+
facility_msg = "DBMS";
|
117
|
+
if (error) {
|
118
|
+
err_code = error->err_code;
|
119
|
+
err_msg = error->err_msg;
|
120
|
+
} else {
|
121
|
+
err_code = 0;
|
122
|
+
err_msg = "Unknown DBMS Error";
|
123
|
+
}
|
124
|
+
} else {
|
125
|
+
err_msg = get_error_msg(e);
|
126
|
+
err_code = e;
|
127
|
+
|
128
|
+
if (e > CAS_ER_IS){
|
129
|
+
facility_msg = "CAS";
|
130
|
+
}
|
131
|
+
else if (e > -20100){
|
132
|
+
facility_msg = "CCI";
|
133
|
+
}
|
134
|
+
else{
|
135
|
+
facility_msg = "CLIENT";
|
136
|
+
}
|
137
|
+
|
138
|
+
}
|
139
|
+
|
140
|
+
if (!err_msg) {
|
141
|
+
err_code = cci_get_err_msg(e,buf,128);
|
142
|
+
if(err_code<0)
|
143
|
+
err_msg = "Unknown Error";
|
144
|
+
else
|
145
|
+
err_msg = buf;
|
146
|
+
}
|
147
|
+
|
148
|
+
sprintf(msg, "ERROR: %s, %d, %s", facility_msg, err_code, err_msg);
|
149
|
+
rb_raise(GeteCubrid(), msg);
|
150
|
+
}
|
151
|
+
|