CUBRID Engine  latest
cas_meta.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * cas_meta.c -
21  */
22 
23 #ident "$Id$"
24 
25 #include <assert.h>
26 
27 #include "porting.h"
28 #include "cas_protocol.h"
29 
30 #define SET_BIT(C,B) ((C) |= (B))
31 #define CLEAR_BIT(C,B) ((C) &= ~(B))
32 #define IS_SET_BIT(C,B) (((C) & (B)) == (B))
33 
34 static char broker_info[BROKER_INFO_SIZE] = {
41  0,
42  0
43 };
44 
45 typedef enum
46 {
50 
51 const char *
53 {
54  return broker_info;
55 }
56 
57 void
58 cas_bi_set_dbms_type (const char dbms_type)
59 {
61 }
62 
63 char
65 {
67 }
68 
69 void
70 cas_bi_set_keep_connection (const char keep_connection)
71 {
72  broker_info[BROKER_INFO_KEEP_CONNECTION] = keep_connection;
73 }
74 
75 char
77 {
79 }
80 
81 void
82 cas_bi_set_statement_pooling (const char statement_pooling)
83 {
84  assert (statement_pooling == 0 || statement_pooling == 1);
85 
86  if (statement_pooling)
87  {
89  }
90  else
91  {
93  }
94 }
95 
96 char
98 {
100 }
101 
102 void
103 cas_bi_set_cci_pconnect (const char cci_pconnect)
104 {
105  assert (cci_pconnect == 0 || cci_pconnect == 1);
106 
107  if (cci_pconnect)
108  {
110  }
111  else
112  {
114  }
115 }
116 
117 char
119 {
121 }
122 
123 void
124 cas_bi_set_protocol_version (const char protocol_version)
125 {
126  broker_info[BROKER_INFO_PROTO_VERSION] = protocol_version;
127 }
128 
129 char
131 {
133 }
134 
135 static void
137 {
138  switch (function_code)
139  {
140  case BI_FUNC_ERROR_CODE:
142  break;
144  SET_BIT (broker_info[BROKER_INFO_FUNCTION_FLAG], BROKER_SUPPORT_HOLDABLE_RESULT);
145  break;
146  default:
147  assert (false);
148  break;
149  }
150 }
151 
152 static void
154 {
155  switch (function_code)
156  {
157  case BI_FUNC_ERROR_CODE:
159  break;
161  CLEAR_BIT (broker_info[BROKER_INFO_FUNCTION_FLAG], BROKER_SUPPORT_HOLDABLE_RESULT);
162  break;
163  default:
164  assert (false);
165  break;
166  }
167 }
168 
169 static bool
171 {
172  switch (function_code)
173  {
174  case BI_FUNC_ERROR_CODE:
177  return IS_SET_BIT (broker_info[BROKER_INFO_FUNCTION_FLAG], BROKER_SUPPORT_HOLDABLE_RESULT);
178  default:
179  return 0;
180  }
181 }
182 
183 void
184 cas_bi_set_renewed_error_code (const bool renewed_error_code)
185 {
186  if (renewed_error_code)
187  {
189  }
190  else
191  {
193  }
194 }
195 
196 bool
198 {
200 }
201 
202 bool
203 cas_di_understand_renewed_error_code (const char *driver_info)
204 {
206  {
207  return false;
208  }
209 
211 }
212 
213 void
214 cas_bi_make_broker_info (char *broker_info, char dbms_type, char statement_pooling, char cci_pconnect)
215 {
216  broker_info[BROKER_INFO_DBMS_TYPE] = dbms_type;
218  if (statement_pooling)
219  {
221  }
222  else
223  {
225  }
226  broker_info[BROKER_INFO_CCI_PCONNECT] = (cci_pconnect ? CCI_PCONNECT_ON : CCI_PCONNECT_OFF);
227 
230  broker_info[BROKER_INFO_RESERVED2] = 0;
231  broker_info[BROKER_INFO_RESERVED3] = 0;
232 }
#define SET_BIT(C, B)
Definition: cas_meta.c:30
static void cas_bi_set_function_disable(BI_FUNCTION_CODE function_code)
Definition: cas_meta.c:153
static bool cas_bi_is_enabled_function(BI_FUNCTION_CODE function_code)
Definition: cas_meta.c:170
#define CLEAR_BIT(C, B)
Definition: cas_meta.c:31
#define CAS_KEEP_CONNECTION_ON
Definition: cas_protocol.h:136
char cas_bi_get_cci_pconnect(void)
Definition: cas_meta.c:118
char cas_bi_get_keep_connection(void)
Definition: cas_meta.c:76
#define CAS_PROTO_INDICATOR
Definition: cas_protocol.h:281
#define SRV_CON_MSG_IDX_PROTO_VERSION
Definition: cas_protocol.h:46
#define CCI_PCONNECT_ON
Definition: cas_protocol.h:144
void cas_bi_set_keep_connection(const char keep_connection)
Definition: cas_meta.c:70
const char * cas_bi_get_broker_info(void)
Definition: cas_meta.c:52
bool cas_bi_get_renewed_error_code(void)
Definition: cas_meta.c:197
void cas_bi_set_renewed_error_code(const bool renewed_error_code)
Definition: cas_meta.c:184
void cas_bi_set_cci_pconnect(const char cci_pconnect)
Definition: cas_meta.c:103
char cas_bi_get_protocol_version(void)
Definition: cas_meta.c:130
#define assert(x)
static char broker_info[BROKER_INFO_SIZE]
Definition: cas_meta.c:34
char cas_bi_get_statement_pooling(void)
Definition: cas_meta.c:97
static void cas_bi_set_function_enable(BI_FUNCTION_CODE function_code)
Definition: cas_meta.c:136
BI_FUNCTION_CODE
Definition: cas_meta.c:45
#define BROKER_INFO_SIZE
Definition: cas_protocol.h:116
void cas_bi_set_dbms_type(const char dbms_type)
Definition: cas_meta.c:58
void cas_bi_make_broker_info(char *broker_info, char dbms_type, char statement_pooling, char cci_pconnect)
Definition: cas_meta.c:214
#define BROKER_RENEWED_ERROR_CODE
Definition: cas_protocol.h:117
#define BROKER_SUPPORT_HOLDABLE_RESULT
Definition: cas_protocol.h:118
void cas_bi_set_statement_pooling(const char statement_pooling)
Definition: cas_meta.c:82
bool cas_di_understand_renewed_error_code(const char *driver_info)
Definition: cas_meta.c:203
#define CCI_PCONNECT_OFF
Definition: cas_protocol.h:143
#define CAS_STATEMENT_POOLING_ON
Definition: cas_protocol.h:141
#define CAS_PROTO_PACK_CURRENT_NET_VER
Definition: cas_protocol.h:298
#define CAS_STATEMENT_POOLING_OFF
Definition: cas_protocol.h:140
void cas_bi_set_protocol_version(const char protocol_version)
Definition: cas_meta.c:124
char cas_bi_get_dbms_type(void)
Definition: cas_meta.c:64
#define IS_SET_BIT(C, B)
Definition: cas_meta.c:32