windows changes
[csql.git] / src / odbc / odbcState.cxx
bloba215421a5caf210be3df2031c9118c3fcfc6b7d5
2 /* Description: State Transition Functions.
3 States which are maintained by DriverManager is
4 not used. Implementation of DriverManager would use them.
6 */
8 #include "odbcCommon.h"
10 // Related to Environment Handle
11 //------------------------------
12 SQLRETURN CSqlOdbcEnv::chkStateForSQLFreeHandle( void )
14 switch( state_ )
16 case E0:
17 case E1: break;
18 case E2: err_.set( ERROR_FUNCSEQ );
19 return( SQL_ERROR );
21 return( SQL_SUCCESS );
23 SQLRETURN CSqlOdbcEnv::chkStateForSQLSetEnvAttr( void )
25 switch( state_ )
27 case E0:
28 case E1: break;
29 case E2: err_.set( ERROR_ATTR_CANNOT_SET );
30 return( SQL_ERROR );
32 return( SQL_SUCCESS );
35 // Related to Connection Handle
36 //------------------------------
37 SQLRETURN CSqlOdbcDbc::chkStateForSQLFreeHandle( void )
39 switch( state_ )
41 case C0:
42 case C1:
43 case C2: break;
44 case C3:
45 case C4:
46 case C5:
47 case C6: err_.set( ERROR_FUNCSEQ );
48 return( SQL_ERROR );
50 return( SQL_SUCCESS );
52 SQLRETURN CSqlOdbcDbc::chkStateForSQLConnect( void )
54 switch( state_ )
56 case C0:
57 case C1:
58 case C2: break;
59 case C3:
60 case C4:
61 case C5:
62 case C6: err_.set( ERROR_CONNINUSE );
63 return( SQL_ERROR );
65 return( SQL_SUCCESS );
67 SQLRETURN CSqlOdbcDbc::chkStateForSQLDisconnect( void )
69 switch( state_ )
71 case C0:
72 case C1:
73 case C2: err_.set( ERROR_CONNOTOPEN );
74 return( SQL_ERROR );
75 case C3:
76 case C4:
77 case C5: break;
78 case C6: err_.set( ERROR_INVTRANSTATE );
79 return( SQL_ERROR );
81 return( SQL_SUCCESS );
83 SQLRETURN CSqlOdbcDbc::chkStateForSQLEndTran( void )
85 switch( state_ )
87 case C0:
88 case C1:
89 case C2:
90 case C3: err_.set( ERROR_NOTOPENED );
91 return( SQL_ERROR );
92 case C4:
93 case C5:
94 case C6: break;
96 return( SQL_SUCCESS );
98 SQLRETURN CSqlOdbcDbc::chkStateForSQLSetConnectAttr( void )
100 switch( state_ )
102 case C0:
103 case C1:
104 case C2:
105 case C3:
106 case C4:
107 case C5: break;
108 case C6: err_.set( ERROR_FUNCSEQ );
109 return( SQL_ERROR );
111 return( SQL_SUCCESS );
114 // Related to Statement Handle
115 //------------------------------
116 SQLRETURN CSqlOdbcStmt::chkStateForSQLFreeHandle( void )
118 switch( state_ )
120 case S0:
121 case S1:
122 case S2:
123 case S3:
124 case S4:
125 case S5:
126 case S6:
127 case S7: break;
128 case S8:
129 case S9:
130 case S10:
131 case S11:
132 case S12: err_.set( ERROR_FUNCSEQ );
133 return( SQL_ERROR );
135 return( SQL_SUCCESS );
137 SQLRETURN CSqlOdbcStmt::chkStateForSQLFreeStmt( void )
139 switch( state_ )
141 case S0:
142 case S1:
143 case S2:
144 case S3:
145 case S4:
146 case S5:
147 case S6:
148 case S7: break;
149 case S8:
150 case S9:
151 case S10:
152 case S11:
153 case S12: err_.set( ERROR_FUNCSEQ );
154 return( SQL_ERROR );
156 return( SQL_SUCCESS );
158 SQLRETURN CSqlOdbcStmt::chkStateForSQLBindCol( void )
160 switch( state_ )
162 case S0:
163 case S1:
164 case S2:
165 case S3:
166 case S4:
167 case S5:
168 case S6:
169 case S7: break;
170 case S8:
171 case S9:
172 case S10:
173 case S11:
174 case S12: err_.set( ERROR_FUNCSEQ );
175 return( SQL_ERROR );
177 return( SQL_SUCCESS );
179 SQLRETURN CSqlOdbcStmt::chkStateForSQLBindParameter( void )
181 switch( state_ )
183 case S0:
184 case S1:
185 case S2:
186 case S3:
187 case S4:
188 case S5:
189 case S6:
190 case S7: break;
191 case S8:
192 case S9:
193 case S10:
194 case S11:
195 case S12: err_.set( ERROR_FUNCSEQ );
196 return( SQL_ERROR );
198 return( SQL_SUCCESS );
200 SQLRETURN CSqlOdbcStmt::chkStateForSQLPrepare( void )
202 switch( state_ )
204 case S0:
205 case S1:
206 case S2:
207 case S3:
208 case S4: break;
210 case S5:
211 case S6:
212 case S7: err_.set( ERROR_INVCURSTATE );
213 return( SQL_ERROR );
214 case S8:
215 case S9:
216 case S10:
217 case S11:
218 case S12: err_.set( ERROR_FUNCSEQ );
219 return( SQL_ERROR );
221 return( SQL_SUCCESS );
223 SQLRETURN CSqlOdbcStmt::chkStateForSQLExecute( void )
225 switch( state_ )
227 case S2:
228 case S3:
229 case S4: break;
231 case S5:
232 case S6:
233 case S7: err_.set( ERROR_INVCURSTATE );
234 return( SQL_ERROR );
236 case S0:
237 case S1:
238 case S8:
239 case S9:
240 case S10:
241 case S11:
242 case S12: err_.set( ERROR_FUNCSEQ );
243 return( SQL_ERROR );
245 return( SQL_SUCCESS );
247 SQLRETURN CSqlOdbcStmt::chkStateForSQLExecDirect( void )
249 switch( state_ )
251 case S0:
252 case S1:
253 case S2:
254 case S3:
255 case S4: break;
257 case S5:
258 case S6:
259 case S7: err_.set( ERROR_INVCURSTATE );
260 return( SQL_ERROR );
262 case S8:
263 case S9:
264 case S10:
265 case S11:
266 case S12: err_.set( ERROR_FUNCSEQ );
267 return( SQL_ERROR );
269 return( SQL_SUCCESS );
271 SQLRETURN CSqlOdbcStmt::chkStateForSQLFetch( void )
273 switch( state_ )
275 case S0:
276 case S1:
277 case S2:
278 case S3: err_.set( ERROR_NOT_PREPAREDSTMT );
279 return( SQL_ERROR );
280 case S4: err_.set( ERROR_INVCURSTATE );
281 return( SQL_ERROR );
282 case S5:
283 case S6:
284 case S7: break;
286 case S8:
287 case S9:
288 case S10:
289 case S11:
290 case S12: err_.set( ERROR_FUNCSEQ );
291 return( SQL_ERROR );
293 return( SQL_SUCCESS );
295 SQLRETURN CSqlOdbcStmt::chkStateForSQLCloseCursor( void )
297 switch( state_ )
299 case S0:
300 case S1:
301 case S2:
302 case S3:
303 case S4: err_.set( ERROR_INVCURSTATE );
304 return( SQL_ERROR );
305 case S5:
306 case S6:
307 case S7: break;
308 case S8:
309 case S9:
310 case S10:
311 case S11:
312 case S12: err_.set( ERROR_FUNCSEQ );
313 return( SQL_ERROR );
315 return( SQL_SUCCESS );
317 SQLRETURN CSqlOdbcStmt::chkStateForSQLGetCursorName( void )
319 switch( state_ )
321 case S0:
322 case S1:
323 case S2:
324 case S3:
325 case S4:
326 case S5:
327 case S6:
328 case S7: break;
330 case S8:
331 case S9:
332 case S10:
333 case S11:
334 case S12: err_.set( ERROR_FUNCSEQ );
335 return( SQL_ERROR );
337 return( SQL_SUCCESS );
339 SQLRETURN CSqlOdbcStmt::chkStateForSQLSetCursorName( void )
341 switch( state_ )
343 case S0:
344 case S1:
345 case S2:
346 case S3: break;
348 case S4:
349 case S5:
350 case S6:
351 case S7:
352 case S8: err_.set( ERROR_INVCURSTATE );
353 return( SQL_ERROR );
354 case S9:
355 case S10:
356 case S11:
357 case S12: err_.set( ERROR_FUNCSEQ );
358 return( SQL_ERROR );
360 return( SQL_SUCCESS );
362 SQLRETURN CSqlOdbcStmt::chkStateForSQLNumResultCols( void )
364 switch( state_ )
366 case S2:
367 case S3:
368 case S4:
369 case S5:
370 case S6:
371 case S7: break;
373 case S0:
374 case S1:
376 case S8:
377 case S9:
378 case S10:
379 case S11:
380 case S12: err_.set( ERROR_FUNCSEQ );
381 return( SQL_ERROR );
383 return( SQL_SUCCESS );
385 SQLRETURN CSqlOdbcStmt::chkStateForSQLRowCount( void )
387 switch( state_ )
389 case S4:
390 case S5:
391 case S6: break;
393 case S0:
394 case S1:
395 case S2:
396 case S3:
398 case S7:
399 case S8:
400 case S9:
401 case S10:
402 case S11:
403 case S12: err_.set( ERROR_FUNCSEQ );
404 return( SQL_ERROR );
406 return( SQL_SUCCESS );
408 SQLRETURN CSqlOdbcStmt::chkStateForSQLDescribeCol( void )
410 switch( state_ )
412 case S4: err_.set( ERROR_INVCURSTATE );
413 return( SQL_ERROR );
415 case S3:
416 case S5:
417 case S6:
418 case S7: break;
420 case S0:
421 case S1:
422 case S2:
424 case S8:
425 case S9:
426 case S10:
427 case S11:
428 case S12: err_.set( ERROR_FUNCSEQ );
429 return( SQL_ERROR );
431 return( SQL_SUCCESS );
433 SQLRETURN CSqlOdbcStmt::chkStateForSQLNumParams(void )
435 switch( state_ )
438 case S0: err_.set(ERROR_INVCURSTATE );
439 return( SQL_ERROR );
440 case S2:
441 case S3:
442 case S4:
443 case S5:
444 case S6:
445 case S7: break;
446 case S1:
447 case S8:
448 case S9:
449 case S10:
450 case S11:
451 case S12: err_.set( ERROR_FUNCSEQ );
452 return( SQL_ERROR );
454 return( SQL_SUCCESS );
457 SQLRETURN CSqlOdbcStmt::chkStateForSQLDescribeParam(void)
459 switch( state_ )
461 case S2:
462 case S3:break;
463 case S0:
464 case S1:
465 case S5:
466 case S6:
467 case S7:
468 case S8:
469 case S9:
470 case S10:
471 case S11:
472 case S12: err_.set( ERROR_FUNCSEQ );
473 return( SQL_ERROR );
475 return( SQL_SUCCESS );