00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "ocilib_internal.h"
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 OCI_Connection * OCI_ConnectionAllocate
00046 (
00047 OCI_Pool *pool,
00048 const mtext *db,
00049 const mtext *user,
00050 const mtext *pwd,
00051 unsigned int mode
00052 )
00053 {
00054 OCI_Connection *con = NULL;
00055 OCI_List *list = NULL;
00056 OCI_Item *item = NULL;
00057 boolean res = TRUE;
00058
00059
00060
00061 if (pool != NULL)
00062 list = pool->cons;
00063 else
00064 list = OCILib.cons;
00065
00066 item = OCI_ListAppend(list, sizeof(*con));
00067
00068 if (item != NULL)
00069 {
00070 con = (OCI_Connection *) item->data;
00071
00072
00073
00074 con->stmts = OCI_ListCreate(OCI_IPC_STATEMENT);
00075
00076 if (res == TRUE)
00077 {
00078 con->tinfs = OCI_ListCreate(OCI_IPC_TYPE_INFO);
00079 res = (con->tinfs != NULL);
00080 }
00081
00082 if (res == TRUE)
00083 {
00084 con->trsns = OCI_ListCreate(OCI_IPC_TRANSACTION);
00085 res = (con->trsns != NULL);
00086 }
00087
00088
00089
00090 if (res == TRUE)
00091 {
00092 con->mode = mode;
00093 con->pool = pool;
00094 con->sess_tag = NULL;
00095
00096 if (con->pool != NULL)
00097 {
00098 con->db = (mtext *) db;
00099 con->user = (mtext *) user;
00100 con->pwd = (mtext *) pwd;
00101 }
00102 else
00103 {
00104 con->db = mtsdup(db != NULL ? db : MT(""));
00105 con->user = mtsdup(user != NULL ? user : MT(""));
00106 con->pwd = mtsdup(pwd != NULL ? pwd : MT(""));
00107 }
00108 }
00109
00110
00111
00112 if (res == TRUE)
00113 res = (OCI_SUCCESS == OCI_HandleAlloc((dvoid *) OCILib.env,
00114 (dvoid **) (void *) &con->err,
00115 (ub4) OCI_HTYPE_ERROR,
00116 (size_t) 0, (dvoid **) NULL));
00117 }
00118 else
00119 res = FALSE;
00120
00121
00122
00123 if (res == TRUE)
00124 {
00125 con->cstate = OCI_CONN_ALLOCATED;
00126 }
00127 else
00128 {
00129 OCI_ConnectionFree(con);
00130 con = NULL;
00131 }
00132
00133 return con;
00134 }
00135
00136
00137
00138
00139
00140 boolean OCI_ConnectionDeallocate
00141 (
00142 OCI_Connection *con
00143 )
00144 {
00145 OCI_CHECK(con == NULL, FALSE);
00146 OCI_CHECK(con->cstate != OCI_CONN_ALLOCATED, FALSE);
00147
00148
00149
00150 if (con->err != NULL)
00151 OCI_HandleFree((dvoid *) con->err, (ub4) OCI_HTYPE_ERROR);
00152
00153
00154
00155 if (con->svr != NULL)
00156 OCI_HandleFree((dvoid *) con->svr, (ub4) OCI_HTYPE_SERVER);
00157
00158 con->cxt = NULL;
00159 con->ses = NULL;
00160 con->svr = NULL;
00161 con->err = NULL;
00162
00163 return TRUE;
00164 }
00165
00166
00167
00168
00169
00170 boolean OCI_ConnectionAttach
00171 (
00172 OCI_Connection *con
00173 )
00174 {
00175 void *ostr = NULL;
00176 int osize = -1;
00177 boolean res = TRUE;
00178 ub4 cmode = OCI_DEFAULT;
00179
00180 OCI_CHECK(con == NULL, FALSE);
00181 OCI_CHECK(con->cstate != OCI_CONN_ALLOCATED, FALSE);
00182
00183
00184
00185 if (con->pool == NULL)
00186 {
00187 res = (OCI_SUCCESS == OCI_HandleAlloc((dvoid *) OCILib.env,
00188 (dvoid **) (void *) &con->svr,
00189 (ub4) OCI_HTYPE_SERVER,
00190 (size_t) 0, (dvoid **) NULL));
00191
00192
00193
00194 #if OCI_VERSION_COMPILE >= OCI_9_0
00195
00196 if (OCILib.version_runtime >= OCI_9_0 && con->pool != NULL)
00197 {
00198 ostr = OCI_GetInputMetaString(con->pool->name, &osize);
00199 cmode = OCI_CPOOL;
00200 }
00201 else
00202
00203 #endif
00204
00205 {
00206 ostr = OCI_GetInputMetaString(con->db, &osize);
00207 }
00208
00209 OCI_CALL2
00210 (
00211 res, con,
00212
00213 OCIServerAttach(con->svr, con->err,(OraText *) ostr,
00214 (sb4) osize, cmode)
00215 )
00216
00217 OCI_ReleaseMetaString(ostr);
00218 }
00219
00220
00221
00222 if (res == TRUE)
00223 {
00224 if (OCILib.version_runtime < OCI_9_0 && con->pool != NULL)
00225 con->pool->nb_opened++;
00226
00227 con->cstate = OCI_CONN_ATTACHED;
00228 }
00229
00230 return res;
00231 }
00232
00233
00234
00235
00236
00237 boolean OCI_ConnectionDetach
00238 (
00239 OCI_Connection *con
00240 )
00241 {
00242 boolean res = TRUE;
00243
00244 OCI_CHECK(con == NULL, FALSE);
00245 OCI_CHECK(con->cstate != OCI_CONN_ATTACHED, FALSE);
00246
00247 if (con->svr != NULL)
00248 {
00249
00250
00251 OCI_CALL2
00252 (
00253 res, con,
00254
00255 OCIServerDetach(con->svr, con->err, (ub4) OCI_DEFAULT)
00256 )
00257
00258
00259
00260 OCI_HandleFree((dvoid *) con->svr, (ub4) OCI_HTYPE_SERVER);
00261
00262 con->svr = NULL;
00263 }
00264
00265
00266
00267 if (res == TRUE)
00268 {
00269 if (OCILib.version_runtime < OCI_9_0 && con->pool != NULL)
00270 con->pool->nb_opened--;
00271
00272 con->cstate = OCI_CONN_ALLOCATED;
00273 }
00274
00275 return res;
00276 }
00277
00278
00279
00280
00281
00282 boolean OCI_ConnectionLogon
00283 (
00284 OCI_Connection *con,
00285 const mtext *new_pwd,
00286 const mtext *tag
00287 )
00288 {
00289 void *ostr = NULL;
00290 int osize = -1;
00291 boolean res = TRUE;
00292
00293 OCI_CHECK(con == NULL, FALSE);
00294
00295 #if OCI_VERSION_COMPILE < OCI_9_2
00296
00297 OCI_NOT_USED(tag)
00298
00299 #endif
00300
00301 #if OCI_VERSION_COMPILE >= OCI_9_2
00302
00303 if (con->pool == NULL)
00304 {
00305
00306 #endif
00307
00308
00309
00310 if (res == TRUE)
00311 res = (OCI_SUCCESS == OCI_HandleAlloc((dvoid *) OCILib.env,
00312 (dvoid **) (void *) &con->ses,
00313 (ub4) OCI_HTYPE_SESSION,
00314 (size_t) 0, (dvoid **) NULL));
00315
00316
00317
00318 if (res == TRUE)
00319 res = (OCI_SUCCESS == OCI_HandleAlloc((dvoid *) OCILib.env,
00320 (dvoid **) (void *) &con->cxt,
00321 (ub4) OCI_HTYPE_SVCCTX,
00322 (size_t) 0, (dvoid **) NULL));
00323
00324
00325
00326 OCI_CALL2
00327 (
00328 res, con,
00329
00330 OCIAttrSet((dvoid *) con->cxt, (ub4) OCI_HTYPE_SVCCTX,
00331 (dvoid *) con->svr, (ub4) sizeof (con->svr),
00332 (ub4) OCI_ATTR_SERVER, con->err)
00333 )
00334
00335
00336
00337 if (new_pwd && new_pwd[0])
00338 {
00339 int osize1 = -1;
00340 int osize2 = -1;
00341 int osize3 = -1;
00342 void *ostr1 = NULL;
00343 void *ostr2 = NULL;
00344 void *ostr3 = NULL;
00345
00346 ostr1 = OCI_GetInputMetaString(con->user, &osize1);
00347 ostr2 = OCI_GetInputMetaString(con->pwd, &osize2);
00348 ostr3 = OCI_GetInputMetaString(new_pwd, &osize3);
00349
00350 OCI_CALL2
00351 (
00352 res, con,
00353
00354 OCIAttrSet((dvoid *) con->cxt, (ub4) OCI_HTYPE_SVCCTX,
00355 (dvoid *) con->ses, (ub4) sizeof(con->ses),
00356 (ub4) OCI_ATTR_SESSION, con->err)
00357 )
00358
00359 OCI_CALL2
00360 (
00361 res, con,
00362
00363 OCIPasswordChange(con->cxt, con->err,
00364 (OraText *) ostr1, (ub4) osize1,
00365 (OraText *) ostr2, (ub4) osize2,
00366 (OraText *) ostr3, (ub4) osize3,
00367 OCI_AUTH)
00368 )
00369
00370 OCI_ReleaseMetaString(ostr1);
00371 OCI_ReleaseMetaString(ostr2);
00372 OCI_ReleaseMetaString(ostr3);
00373
00374
00375 if (res == TRUE)
00376 {
00377 OCI_FREE(con->pwd);
00378
00379 con->pwd = mtsdup(new_pwd);
00380 }
00381 }
00382 else
00383 {
00384
00385
00386 if ((res == TRUE) && (con->user != NULL) && (con->user[0] != 0))
00387 {
00388 osize = -1;
00389 ostr = OCI_GetInputMetaString(con->user, &osize);
00390
00391 OCI_CALL2
00392 (
00393 res, con,
00394
00395 OCIAttrSet((dvoid *) con->ses,(ub4) OCI_HTYPE_SESSION,
00396 (dvoid *) ostr, (ub4) osize,
00397 (ub4) OCI_ATTR_USERNAME, con->err)
00398 )
00399
00400 OCI_ReleaseMetaString(ostr);
00401 }
00402
00403
00404
00405 if ((res == TRUE) && (con->pwd != NULL) && (con->pwd[0] != 0))
00406 {
00407 osize = -1;
00408 ostr = OCI_GetInputMetaString(con->pwd, &osize);
00409
00410 OCI_CALL2
00411 (
00412 res, con,
00413
00414 OCIAttrSet((dvoid *) con->ses, (ub4) OCI_HTYPE_SESSION,
00415 (dvoid *) ostr, (ub4) osize,
00416 (ub4) OCI_ATTR_PASSWORD, con->err)
00417 )
00418
00419 OCI_ReleaseMetaString(ostr);
00420 }
00421
00422
00423
00424 if (res == TRUE)
00425 {
00426 ub4 credt = OCI_CRED_RDBMS;
00427
00428 if (((con->user == NULL) || (con->user[0] == 0)) &&
00429 ((con->pwd == NULL) || (con->pwd[0] == 0)))
00430 {
00431 credt = OCI_CRED_EXT;
00432 }
00433
00434 OCI_CALL2
00435 (
00436 res, con,
00437
00438 OCISessionBegin(con->cxt, con->err, con->ses, credt, con->mode)
00439 )
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450 OCI_CALL2
00451 (
00452 res, con,
00453
00454 OCIAttrSet((dvoid *) con->cxt, (ub4) OCI_HTYPE_SVCCTX,
00455 (dvoid *) con->ses, (ub4) sizeof(con->ses),
00456 (ub4) OCI_ATTR_SESSION, con->err)
00457 )
00458 }
00459 }
00460
00461 #if OCI_VERSION_COMPILE >= OCI_9_2
00462
00463 }
00464 else
00465 {
00466 if (OCILib.version_runtime >= OCI_9_0)
00467 {
00468
00469 ub4 mode = OCI_DEFAULT;
00470 boolean found = FALSE;
00471 void *ostr_tag = NULL;
00472 int osize_tag = 0;
00473
00474 OraText *ostr_ret = NULL;
00475 ub4 osize_ret = 0;
00476
00477 osize = -1;
00478 ostr = OCI_GetInputMetaString(con->pool->name, &osize);
00479
00480 if (con->pool->htype == OCI_HTYPE_CPOOL)
00481 {
00482 mode = OCI_SESSGET_CPOOL;
00483 }
00484 else
00485 {
00486 mode = OCI_SESSGET_SPOOL;
00487
00488 if (tag != NULL)
00489 {
00490 osize_tag = -1;
00491 ostr_tag = OCI_GetInputMetaString(tag, &osize_tag);
00492 }
00493 }
00494
00495 OCI_CALL2
00496 (
00497 res, con,
00498
00499 OCISessionGet(OCILib.env, con->err, &con->cxt, con->pool->authp,
00500 (dvoid *) ostr, (ub4) osize, ostr_tag, osize_tag,
00501 &ostr_ret, &osize_ret, &found, mode)
00502 )
00503
00504 if (res == TRUE)
00505 {
00506 con->ses = (OCISession *) con->pool->authp;
00507
00508 if (found == TRUE)
00509 {
00510 OCI_SetSessionTag(con, tag);
00511 }
00512 }
00513 }
00514 }
00515
00516 #endif
00517
00518
00519
00520 if (res == TRUE)
00521 {
00522
00523
00524 OCI_GetVersionServer(con);
00525
00526 if (!(con->mode & OCI_PRELIM_AUTH))
00527 {
00528
00529
00530 con->trs = OCI_TransactionCreate(con, 1, OCI_TRANS_READWRITE, NULL);
00531
00532
00533
00534 res = OCI_TransactionStart(con->trs);
00535 }
00536 }
00537
00538
00539
00540 #if OCI_VERSION_COMPILE >= OCI_11_1
00541
00542 if ((res == TRUE) && (OCILib.version_runtime >= OCI_11_1) && (con->ver_num >= OCI_11_1))
00543 {
00544 osize = -1;
00545 ostr = OCI_GetInputMetaString(OCILIB_DRIVER_NAME, &osize);
00546
00547 OCI_CALL2
00548 (
00549 res, con,
00550
00551 OCIAttrSet((dvoid *) con->ses, (ub4) OCI_HTYPE_SESSION,
00552 (dvoid *) ostr, (ub4) osize,
00553 (ub4) OCI_ATTR_DRIVER_NAME, con->err)
00554 )
00555
00556 OCI_ReleaseMetaString(ostr);
00557 }
00558
00559 #endif
00560
00561
00562
00563 if (res == TRUE)
00564 {
00565 if (OCILib.version_runtime < OCI_9_0 && con->pool != NULL)
00566 con->pool->nb_busy++;
00567
00568 con->cstate = OCI_CONN_LOGGED;
00569 }
00570
00571 return res;
00572 }
00573
00574
00575
00576
00577
00578 boolean OCI_ConnectionLogOff
00579 (
00580 OCI_Connection *con
00581 )
00582 {
00583 boolean res = TRUE;
00584
00585 OCI_CHECK(con == NULL, FALSE);
00586 OCI_CHECK(con->cstate != OCI_CONN_LOGGED, FALSE);
00587
00588
00589
00590 OCI_SubscriptionDetachConnection(con);
00591
00592
00593
00594 OCI_ListForEach(con->stmts, (POCI_LIST_FOR_EACH) OCI_StatementClose);
00595 OCI_ListClear(con->stmts);
00596
00597
00598
00599 OCI_ListForEach(con->trsns, (POCI_LIST_FOR_EACH) OCI_TransactionClose);
00600 OCI_ListClear(con->trsns);
00601
00602
00603
00604 OCI_ListForEach(con->tinfs, (POCI_LIST_FOR_EACH) OCI_TypeInfoClose);
00605 OCI_ListClear(con->tinfs);
00606
00607
00608
00609 if (con->nb_files > 0)
00610 {
00611 OCILobFileCloseAll(con->cxt, con->err);
00612 }
00613
00614
00615
00616 #if OCI_VERSION_COMPILE >= OCI_9_2
00617
00618 if (con->pool == NULL)
00619 {
00620
00621 #endif
00622
00623
00624
00625 if ((con->cxt != NULL) && (con->err != NULL) && (con->ses != NULL))
00626 {
00627 OCI_CALL2
00628 (
00629 res, con,
00630
00631 OCISessionEnd(con->cxt, con->err, con->ses, (ub4) OCI_DEFAULT)
00632 )
00633
00634
00635
00636 if (con->ses != NULL)
00637 {
00638 OCI_HandleFree((dvoid *) con->ses, (ub4) OCI_HTYPE_SESSION);
00639
00640 con->ses = NULL;
00641 }
00642
00643
00644
00645 if (con->cxt != NULL)
00646 {
00647 OCI_HandleFree((dvoid *) con->cxt, (ub4) OCI_HTYPE_SVCCTX);
00648
00649 con->cxt = NULL;
00650 }
00651 }
00652
00653 #if OCI_VERSION_COMPILE >= OCI_9_2
00654
00655 }
00656 else
00657 {
00658 if (OCILib.version_runtime >= OCI_9_0)
00659 {
00660 void *ostr = NULL;
00661 int osize = 0;
00662 ub4 mode = OCI_DEFAULT;
00663
00664 if ((con->sess_tag != NULL) && (con->pool->htype == (ub4) OCI_HTYPE_SPOOL))
00665 {
00666 osize = -1;
00667 ostr = OCI_GetInputMetaString(con->sess_tag, &osize);
00668 mode = OCI_SESSRLS_RETAG;
00669 }
00670
00671
00672
00673
00674
00675
00676
00677
00678 OCI_CALL2
00679 (
00680 res, con,
00681
00682 OCIAttrSet((dvoid *) con->cxt, (ub4) OCI_HTYPE_SVCCTX,
00683 (dvoid *) NULL, (ub4) 0,
00684 (ub4) OCI_ATTR_TRANS,con->err)
00685 )
00686
00687 OCI_CALL2
00688 (
00689 res, con,
00690
00691 OCISessionRelease(con->cxt, con->err, ostr, (ub4) osize, mode)
00692 )
00693
00694 con->cxt = NULL;
00695 }
00696 }
00697
00698 #endif
00699
00700
00701
00702 if (res == TRUE)
00703 {
00704 con->cstate = OCI_CONN_ATTACHED;
00705
00706 if (OCILib.version_runtime < OCI_9_0 && con->pool != NULL)
00707 con->pool->nb_busy--;
00708 }
00709
00710 return res;
00711 }
00712
00713
00714
00715
00716
00717 boolean OCI_ConnectionClose
00718 (
00719 OCI_Connection *con
00720 )
00721 {
00722 OCI_CHECK(con == NULL, FALSE);
00723
00724
00725
00726 OCI_ServerDisableOutput(con);
00727
00728
00729
00730 OCI_ConnectionLogOff(con);
00731 OCI_ConnectionDetach(con);
00732 OCI_ConnectionDeallocate(con);
00733
00734
00735
00736 OCI_ListFree(con->stmts);
00737 OCI_ListFree(con->trsns);
00738 OCI_ListFree(con->tinfs);
00739
00740 if (con->pool == NULL)
00741 {
00742
00743
00744 OCI_FREE(con->db);
00745 OCI_FREE(con->user);
00746 OCI_FREE(con->pwd);
00747 }
00748
00749 OCI_FREE(con->fmt_date);
00750 OCI_FREE(con->fmt_num);
00751 OCI_FREE(con->ver_str);
00752 OCI_FREE(con->sess_tag);
00753
00754 con->stmts = NULL;
00755 con->trsns = NULL;
00756 con->tinfs = NULL;
00757
00758 return TRUE;
00759 }
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769 OCI_Connection * OCI_API OCI_ConnectionCreate
00770 (
00771 const mtext *db,
00772 const mtext *user,
00773 const mtext *pwd,
00774 unsigned int mode
00775 )
00776 {
00777 OCI_Connection * con;
00778
00779
00780
00781 OCI_CHECK_INITIALIZED(NULL);
00782
00783 con = OCI_ConnectionAllocate(NULL, db, user, pwd, mode);
00784
00785 if (con != NULL)
00786 {
00787 if (OCI_ConnectionAttach(con) == FALSE ||
00788 OCI_ConnectionLogon(con, NULL, NULL) == FALSE)
00789 {
00790 OCI_ConnectionFree(con);
00791 con = NULL;
00792 }
00793 }
00794
00795 OCI_RESULT(con != NULL);
00796
00797 return con;
00798 }
00799
00800
00801
00802
00803
00804 boolean OCI_API OCI_ConnectionFree
00805 (
00806 OCI_Connection *con
00807 )
00808 {
00809 boolean res = TRUE;
00810 OCI_Error *err = NULL;
00811
00812 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00813
00814
00815
00816 err = OCI_ErrorGet(FALSE, FALSE);
00817
00818 if (err != NULL && err->con == con)
00819 err->con = NULL;
00820
00821 OCI_FREE(con->sess_tag);
00822
00823 if (con->pool != NULL)
00824 {
00825 res = OCI_ConnectionLogOff(con);
00826
00827 if (OCILib.version_runtime >= OCI_9_0)
00828 OCI_ConnectionDetach(con);
00829 }
00830 else
00831 {
00832 res = OCI_ConnectionClose(con);
00833 OCI_ListRemove(OCILib.cons, con);
00834 OCI_FREE(con);
00835 }
00836
00837 OCI_RESULT(res);
00838
00839 return res;
00840 }
00841
00842
00843
00844
00845
00846 boolean OCI_API OCI_Commit
00847 (
00848 OCI_Connection *con
00849 )
00850 {
00851 boolean res = TRUE;
00852
00853 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00854
00855 OCI_CALL2
00856 (
00857 res, con,
00858
00859 OCITransCommit(con->cxt, con->err, (ub4) OCI_DEFAULT)
00860 )
00861
00862 OCI_RESULT(res);
00863
00864 return res;
00865 }
00866
00867
00868
00869
00870
00871 boolean OCI_API OCI_Rollback
00872 (
00873 OCI_Connection *con
00874 )
00875 {
00876 boolean res = TRUE;
00877
00878 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00879
00880 OCI_CALL2
00881 (
00882 res, con,
00883
00884 OCITransRollback(con->cxt, con->err, (ub4) OCI_DEFAULT)
00885 )
00886
00887 OCI_RESULT(res);
00888
00889 return res;
00890 }
00891
00892
00893
00894
00895
00896 boolean OCI_API OCI_SetAutoCommit
00897 (
00898 OCI_Connection *con,
00899 boolean enable
00900 )
00901 {
00902 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00903
00904 OCI_RESULT(TRUE);
00905
00906 con->autocom = enable;
00907
00908 return TRUE;
00909 }
00910
00911
00912
00913
00914
00915 boolean OCI_API OCI_GetAutoCommit
00916 (
00917 OCI_Connection *con
00918 )
00919 {
00920 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00921
00922 OCI_RESULT(TRUE);
00923
00924 return con->autocom;
00925 }
00926
00927
00928
00929
00930
00931 boolean OCI_API OCI_IsConnected
00932 (
00933 OCI_Connection *con
00934 )
00935 {
00936 boolean res = TRUE;
00937 ub4 status = 0;
00938 ub4 size = (ub4) sizeof(status);
00939
00940 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00941
00942 OCI_CALL2
00943 (
00944 res, con,
00945
00946 OCIAttrGet((dvoid **) con->svr, (ub4) OCI_HTYPE_SERVER,
00947 (dvoid *) &status, (ub4 *) &size,
00948 (ub4) OCI_ATTR_SERVER_STATUS, con->err)
00949
00950 )
00951
00952 OCI_RESULT(res);
00953
00954 return (status == OCI_SERVER_NORMAL);
00955 }
00956
00957
00958
00959
00960
00961 void * OCI_API OCI_GetUserData
00962 (
00963 OCI_Connection *con
00964 )
00965 {
00966 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
00967
00968 OCI_RESULT(TRUE);
00969
00970 return con->usrdata;
00971 }
00972
00973
00974
00975
00976
00977 boolean OCI_API OCI_SetUserData
00978 (
00979 OCI_Connection *con,
00980 void *data
00981 )
00982 {
00983 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
00984
00985 OCI_RESULT(TRUE);
00986
00987 con->usrdata = data;
00988
00989 return TRUE;
00990 }
00991
00992
00993
00994
00995
00996 boolean OCI_API OCI_SetSessionTag
00997 (
00998 OCI_Connection *con,
00999 const mtext *tag
01000 )
01001 {
01002 boolean res = TRUE;
01003
01004 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01005
01006 OCI_RESULT(TRUE);
01007
01008 OCI_FREE(con->sess_tag);
01009
01010 #if OCI_VERSION_COMPILE >= OCI_9_2
01011
01012 if ((tag != NULL ) &&
01013 (con->pool != NULL ) &&
01014 (con->pool->htype == (ub4) OCI_HTYPE_SPOOL))
01015 {
01016 con->sess_tag = mtsdup(tag);
01017
01018 res = (con->sess_tag != NULL);
01019 }
01020
01021 #else
01022
01023 OCI_NOT_USED(tag)
01024
01025 #endif
01026
01027 OCI_RESULT(res);
01028
01029 return res;
01030 }
01031
01032
01033
01034
01035
01036 const mtext * OCI_API OCI_GetSessionTag
01037 (
01038 OCI_Connection *con
01039 )
01040 {
01041 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01042
01043 OCI_RESULT(TRUE);
01044
01045 return con->sess_tag;
01046 }
01047
01048
01049
01050
01051
01052 const mtext * OCI_API OCI_GetDatabase
01053 (
01054 OCI_Connection *con
01055 )
01056 {
01057 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01058
01059 OCI_RESULT(TRUE);
01060
01061 return (const mtext *) con->db;
01062 }
01063
01064
01065
01066
01067
01068 const mtext * OCI_API OCI_GetUserName
01069 (
01070 OCI_Connection *con
01071 )
01072 {
01073 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01074
01075 OCI_RESULT(TRUE);
01076
01077 return (const mtext *) con->user;
01078 }
01079
01080
01081
01082
01083
01084 const mtext * OCI_API OCI_GetPassword
01085 (
01086 OCI_Connection *con
01087 )
01088 {
01089 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01090
01091 OCI_RESULT(TRUE);
01092
01093 return (const mtext *) con->pwd;
01094 }
01095
01096
01097
01098
01099
01100 boolean OCI_API OCI_SetPassword
01101 (
01102 OCI_Connection *con,
01103 const mtext *password
01104 )
01105 {
01106 boolean res = TRUE;
01107 ub4 mode = OCI_DEFAULT;
01108
01109 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01110 OCI_CHECK_PTR(OCI_IPC_STRING, password, FALSE);
01111
01112 if (con->cstate != OCI_CONN_LOGGED)
01113 {
01114 OCI_ConnectionLogon(con, password, NULL);
01115 }
01116 else
01117 {
01118 int osize1 = -1;
01119 int osize2 = -1;
01120 int osize3 = -1;
01121 void *ostr1 = NULL;
01122 void *ostr2 = NULL;
01123 void *ostr3 = NULL;
01124
01125 ostr1 = OCI_GetInputMetaString(con->user, &osize1);
01126 ostr2 = OCI_GetInputMetaString(con->pwd, &osize2);
01127 ostr3 = OCI_GetInputMetaString(password, &osize3);
01128
01129 OCI_CALL2
01130 (
01131 res, con,
01132
01133 OCIPasswordChange(con->cxt, con->err,
01134 (OraText *) ostr1, (ub4) osize1,
01135 (OraText *) ostr2, (ub4) osize2,
01136 (OraText *) ostr3, (ub4) osize3,
01137 mode)
01138 )
01139
01140 OCI_ReleaseMetaString(ostr1);
01141 OCI_ReleaseMetaString(ostr2);
01142 OCI_ReleaseMetaString(ostr3);
01143 }
01144
01145 OCI_RESULT(res);
01146
01147 return res;
01148 }
01149
01150
01151
01152
01153
01154 boolean OCI_API OCI_SetUserPassword
01155 (
01156 const mtext *db,
01157 const mtext *user,
01158 const mtext *pwd,
01159 const mtext *new_pwd
01160 )
01161 {
01162 OCI_Connection * con = NULL;
01163 boolean res = FALSE;
01164
01165
01166
01167 OCI_CHECK_INITIALIZED(FALSE);
01168
01169 con = OCI_ConnectionAllocate(NULL, db, user, pwd, OCI_AUTH);
01170
01171 if (con != NULL)
01172 {
01173 if (OCI_ConnectionAttach(con) == FALSE ||
01174 OCI_ConnectionLogon(con, new_pwd, NULL) == FALSE)
01175 {
01176 OCI_ConnectionFree(con);
01177 con = NULL;
01178 }
01179 }
01180
01181 if (con != NULL)
01182 {
01183 res = TRUE;
01184 OCI_ConnectionFree(con);
01185 }
01186 else
01187 res = FALSE;
01188
01189 OCI_RESULT(res);
01190
01191 return res;
01192 }
01193
01194
01195
01196
01197
01198 unsigned int OCI_API OCI_GetSessionMode
01199 (
01200 OCI_Connection *con
01201 )
01202 {
01203 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, OCI_UNKNOWN);
01204
01205 OCI_RESULT(TRUE);
01206
01207 return con->mode;
01208 }
01209
01210
01211
01212
01213
01214 const mtext * OCI_API OCI_GetVersionServer
01215 (
01216 OCI_Connection *con
01217 )
01218 {
01219 boolean res = TRUE;
01220
01221 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01222
01223
01224
01225 if ((con->ver_str == NULL) && (!(con->mode & OCI_PRELIM_AUTH)))
01226 {
01227 res = FALSE;
01228
01229 con->ver_str = (mtext *) OCI_MemAlloc(OCI_IPC_STRING, sizeof(mtext),
01230 (size_t) (OCI_SIZE_BUFFER + 1),
01231 FALSE);
01232
01233 if (con->ver_str != NULL)
01234 {
01235 int osize = OCI_SIZE_BUFFER * (int) sizeof(mtext);
01236 void *ostr = NULL;
01237 mtext *p = NULL;
01238
01239 con->ver_str[0] = 0;
01240
01241 res = TRUE;
01242
01243 ostr = OCI_GetInputMetaString(con->ver_str, &osize);
01244
01245 OCI_CALL2
01246 (
01247 res, con,
01248
01249 OCIServerVersion((dvoid *) con->cxt, con->err,
01250 (OraText *) ostr, (ub4) osize,
01251 (ub1) OCI_HTYPE_SVCCTX)
01252 )
01253
01254 OCI_GetOutputMetaString(ostr, con->ver_str, &osize);
01255
01256 OCI_ReleaseMetaString(ostr);
01257
01258 if (res == TRUE)
01259 {
01260 int ver_maj, ver_min, ver_rev;
01261
01262 ver_maj = ver_min = ver_rev = 0;
01263
01264 con->ver_str[osize / (int) sizeof(mtext)] = 0;
01265
01266
01267
01268
01269 for (p = con->ver_str; (p != NULL) && (*p != 0); p++)
01270 {
01271 if (mtisdigit(*p) &&
01272 (*(p + (size_t) 1) != 0) &&
01273 (*(p + (size_t) 1) == MT('.') || (*(p + (size_t) 2) == MT('.') )))
01274 {
01275 if (OCI_NB_ARG_VERSION == mtsscanf(p, MT("%d.%d.%d"),
01276 (int *) &ver_maj,
01277 (int *) &ver_min,
01278 (int *) &ver_rev))
01279 {
01280 con->ver_num = ver_maj*100 + ver_min*10 + ver_rev;
01281 }
01282
01283 break;
01284 }
01285 }
01286 }
01287 else
01288 OCI_FREE(con->ver_str);
01289 }
01290 }
01291
01292 OCI_RESULT(res);
01293
01294 return con->ver_str;
01295 }
01296
01297
01298
01299
01300
01301 unsigned int OCI_API OCI_GetServerMajorVersion
01302 (
01303 OCI_Connection *con
01304 )
01305 {
01306 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, OCI_UNKNOWN);
01307
01308 if (con->ver_num == OCI_UNKNOWN)
01309 OCI_GetVersionServer(con);
01310
01311 OCI_RESULT(con->ver_num != OCI_UNKNOWN);
01312
01313 return (unsigned int) OCI_VER_MAJ(con->ver_num);
01314 }
01315
01316
01317
01318
01319
01320 unsigned int OCI_API OCI_GetServerMinorVersion
01321 (
01322 OCI_Connection *con
01323 )
01324 {
01325 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, OCI_UNKNOWN);
01326
01327 if (con->ver_num == OCI_UNKNOWN)
01328 OCI_GetVersionServer(con);
01329
01330 OCI_RESULT(con->ver_num != OCI_UNKNOWN);
01331
01332 return OCI_VER_MIN(con->ver_num);
01333 }
01334
01335
01336
01337
01338
01339 unsigned int OCI_API OCI_GetServerRevisionVersion
01340 (
01341 OCI_Connection *con
01342 )
01343 {
01344 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, OCI_UNKNOWN);
01345
01346 if (con->ver_num == OCI_UNKNOWN)
01347 OCI_GetVersionServer(con);
01348
01349 OCI_RESULT(con->ver_num != OCI_UNKNOWN);
01350
01351 return (unsigned int) OCI_VER_MAJ(con->ver_num);
01352 }
01353
01354
01355
01356
01357
01358 OCI_Transaction * OCI_API OCI_GetTransaction
01359 (
01360 OCI_Connection *con
01361 )
01362 {
01363 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01364
01365 OCI_RESULT(TRUE);
01366
01367 return con->trs;
01368 }
01369
01370
01371
01372
01373
01374 boolean OCI_API OCI_SetTransaction
01375 (
01376 OCI_Connection *con,
01377 OCI_Transaction *trans
01378 )
01379 {
01380 boolean res = TRUE;
01381
01382 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01383 OCI_CHECK_PTR(OCI_IPC_TRANSACTION, trans, FALSE);
01384
01385 res = OCI_TransactionStop(con->trs);
01386
01387 if (res == TRUE)
01388 con->trs = trans;
01389
01390 OCI_RESULT(res);
01391
01392 return res;
01393 }
01394
01395
01396
01397
01398
01399 unsigned int OCI_API OCI_GetVersionConnection
01400 (
01401 OCI_Connection *con
01402 )
01403 {
01404 int v1, v2;
01405
01406 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, OCI_UNKNOWN);
01407
01408 v1 = OCI_GetOCIRuntimeVersion();
01409 v2 = OCI_GetServerMajorVersion(con);
01410
01411 OCI_RESULT(TRUE);
01412
01413
01414
01415 return (OCILib.version_runtime > con->ver_num) ? con->ver_num : OCILib.version_runtime;
01416 }
01417
01418
01419
01420
01421
01422 boolean OCI_API OCI_SetDefaultFormatDate
01423 (
01424 OCI_Connection *con,
01425 const mtext *format
01426 )
01427 {
01428 boolean res = TRUE;
01429
01430 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01431
01432 OCI_FREE(con->fmt_date);
01433
01434 con->fmt_date = mtsdup(format ? format : OCI_STRING_FORMAT_DATE);
01435
01436 res = (con->fmt_date != NULL);
01437
01438 OCI_RESULT(res);
01439
01440 return res;
01441 }
01442
01443
01444
01445
01446
01447 const mtext * OCI_API OCI_GetDefaultFormatDate
01448 (
01449 OCI_Connection *con
01450 )
01451 {
01452 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01453
01454 OCI_RESULT(TRUE);
01455
01456 if (con->fmt_date == NULL)
01457 OCI_SetDefaultFormatDate(con, NULL);
01458
01459 return (con->fmt_date);
01460 }
01461
01462
01463
01464
01465
01466 boolean OCI_API OCI_SetDefaultFormatNumeric
01467 (
01468 OCI_Connection *con,
01469 const mtext *format
01470 )
01471 {
01472 boolean res = TRUE;
01473
01474 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01475
01476 OCI_FREE(con->fmt_num);
01477
01478 con->fmt_num = mtsdup(format ? format : OCI_STRING_FORMAT_NUM);
01479
01480 res = (con->fmt_num != NULL);
01481
01482 OCI_RESULT(res);
01483
01484 return res;
01485 }
01486
01487
01488
01489
01490
01491 const mtext * OCI_API OCI_GetDefaultFormatNumeric
01492 (
01493 OCI_Connection *con
01494 )
01495 {
01496 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01497
01498 OCI_RESULT(TRUE);
01499
01500 if (con->fmt_num == NULL)
01501 OCI_SetDefaultFormatNumeric(con, NULL);
01502
01503 return (con->fmt_num);
01504 }
01505
01506
01507
01508
01509
01510 boolean OCI_API OCI_Break
01511 (
01512 OCI_Connection *con
01513 )
01514 {
01515 boolean res = TRUE;
01516
01517 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01518
01519 OCI_CALL2
01520 (
01521 res, con,
01522
01523 OCIBreak((dvoid *) con->cxt, con->err)
01524 )
01525
01526 OCI_RESULT(res);
01527
01528 return res;
01529 }
01530
01531
01532
01533
01534
01535 boolean OCI_API OCI_ServerEnableOutput
01536 (
01537 OCI_Connection *con,
01538 unsigned int bufsize,
01539 unsigned int arrsize,
01540 unsigned int lnsize
01541 )
01542 {
01543 boolean res = TRUE;
01544
01545 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01546
01547
01548
01549 if (con->svopt == NULL)
01550 {
01551 con->svopt = (OCI_ServerOutput *) OCI_MemAlloc(OCI_IPC_SERVER_OUPUT,
01552 sizeof(*con->svopt),
01553 (size_t) 1, TRUE);
01554
01555 res = (con->svopt != NULL);
01556 }
01557
01558
01559
01560 if ((res == TRUE) && (con->svopt->arrbuf == NULL))
01561 {
01562 unsigned int charsize = sizeof(dtext);
01563
01564
01565
01566 if (con->ver_num >= OCI_10_2)
01567 {
01568 if (lnsize < OCI_OUPUT_LSIZE)
01569 lnsize = OCI_OUPUT_LSIZE;
01570 else if (lnsize > OCI_OUPUT_LSIZE_10G)
01571 lnsize = OCI_OUPUT_LSIZE_10G;
01572 }
01573 else
01574 {
01575 if (lnsize > OCI_OUPUT_LSIZE)
01576 lnsize = OCI_OUPUT_LSIZE;
01577 }
01578
01579 con->svopt->arrsize = arrsize;
01580 con->svopt->lnsize = lnsize;
01581
01582
01583
01584 con->svopt->arrbuf =
01585
01586 (ub1 *) OCI_MemAlloc(OCI_IPC_STRING,
01587 ((size_t)(con->svopt->lnsize + 1)) * charsize,
01588 (size_t) con->svopt->arrsize, TRUE);
01589
01590 res = (con->svopt->arrbuf != NULL);
01591 }
01592
01593 if (res == TRUE)
01594 {
01595 if (con->svopt->stmt == NULL)
01596 con->svopt->stmt = OCI_StatementCreate(con);
01597
01598 if (con->svopt->stmt != NULL)
01599 {
01600
01601
01602 res = OCI_Prepare(con->svopt->stmt,
01603 MT("BEGIN DBMS_OUTPUT.ENABLE(:n); END;"));
01604
01605 res = res && OCI_BindUnsignedInt(con->svopt->stmt, MT(":n"), &bufsize);
01606
01607 if (bufsize == 0)
01608 res = OCI_BindSetNull(OCI_GetBind(con->svopt->stmt, 1));
01609
01610 res = res && OCI_Execute(con->svopt->stmt);
01611
01612
01613
01614 con->svopt->cursize = con->svopt->arrsize;
01615
01616 res = res && OCI_Prepare(con->svopt->stmt,
01617 MT("BEGIN DBMS_OUTPUT.GET_LINES(:s, :i); END;"));
01618
01619 res = res && OCI_BindArrayOfStrings(con->svopt->stmt,
01620 MT(":s"),
01621 (dtext *) con->svopt->arrbuf,
01622 con->svopt->lnsize,
01623 con->svopt->arrsize);
01624
01625 res = res && OCI_BindUnsignedInt(con->svopt->stmt,
01626 MT(":i"),
01627 &con->svopt->cursize);
01628 }
01629 }
01630
01631 if (res == FALSE)
01632 OCI_ServerDisableOutput(con);
01633
01634 OCI_RESULT(res);
01635
01636 return res;
01637 }
01638
01639
01640
01641
01642
01643 boolean OCI_API OCI_ServerDisableOutput
01644 (
01645 OCI_Connection *con
01646 )
01647 {
01648 boolean res = TRUE;
01649
01650 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01651
01652 if (con->svopt != NULL)
01653 {
01654 res = res && OCI_ExecuteStmt(con->svopt->stmt,
01655 MT("BEGIN DBMS_OUTPUT.DISABLE(); END;"));
01656
01657 res = res && OCI_StatementFree(con->svopt->stmt);
01658
01659 OCI_FREE(con->svopt->arrbuf);
01660 OCI_FREE(con->svopt);
01661 }
01662
01663 OCI_RESULT(res);
01664
01665 return res;
01666 }
01667
01668
01669
01670
01671
01672 const dtext * OCI_API OCI_ServerGetOutput
01673 (
01674 OCI_Connection *con
01675 )
01676 {
01677 boolean res = TRUE;
01678 dtext *str = NULL;
01679
01680 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01681 OCI_CHECK(con->svopt == NULL, FALSE);
01682
01683 if (con->svopt->curpos == 0 || con->svopt->curpos >= con->svopt->cursize)
01684 {
01685 con->svopt->cursize = con->svopt->arrsize;
01686 res = OCI_Execute(con->svopt->stmt);
01687 con->svopt->curpos = 0;
01688 }
01689
01690 if ((res == TRUE) & (con->svopt->cursize > 0))
01691 {
01692 unsigned int charsize = sizeof(dtext);
01693
01694 str = (dtext*) (con->svopt->arrbuf +
01695 (size_t) (((con->svopt->lnsize + 1) * charsize) * con->svopt->curpos++));
01696 }
01697
01698 OCI_RESULT(res);
01699
01700 return (const dtext *) str;
01701 }
01702
01703
01704
01705
01706
01707 boolean OCI_API OCI_SetTrace
01708 (
01709 OCI_Connection *con,
01710 unsigned int trace,
01711 const mtext *value
01712 )
01713 {
01714 boolean res = TRUE;
01715 mtext *str = NULL;
01716
01717 #if OCI_VERSION_COMPILE >= OCI_10_1
01718 ub4 attrib = 0;
01719 #endif
01720
01721 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01722
01723
01724
01725 if (con->trace == NULL)
01726 {
01727 con->trace = (OCI_TraceInfo *) OCI_MemAlloc(OCI_IPC_TRACE_INFO,
01728 sizeof(*con->trace),
01729 (size_t) 1, TRUE);
01730 res = (con->trace != NULL);
01731 }
01732
01733
01734
01735 if (con->trace != NULL)
01736 {
01737 switch (trace)
01738 {
01739 case OCI_TRC_IDENTITY:
01740
01741 #if OCI_VERSION_COMPILE >= OCI_10_1
01742
01743 attrib = OCI_ATTR_CLIENT_IDENTIFIER;
01744
01745 #endif
01746 con->trace->identifier[0] = 0;
01747
01748 mtsncat(con->trace->identifier, value, OCI_SIZE_TRACE_ID);
01749
01750 str = con->trace->identifier;
01751
01752 break;
01753
01754 case OCI_TRC_MODULE:
01755
01756 #if OCI_VERSION_COMPILE >= OCI_10_1
01757
01758 attrib = OCI_ATTR_MODULE;
01759
01760 #endif
01761 con->trace->module[0] = 0;
01762
01763 mtsncat(con->trace->module, value, OCI_SIZE_TRACE_MODULE);
01764
01765 str = con->trace->module;
01766
01767 break;
01768
01769 case OCI_TRC_ACTION:
01770
01771 #if OCI_VERSION_COMPILE >= OCI_10_1
01772
01773 attrib = OCI_ATTR_ACTION;
01774
01775 #endif
01776 con->trace->action[0] = 0;
01777
01778 mtsncat(con->trace->action, value, OCI_SIZE_TRACE_ACTION);
01779
01780 str = con->trace->action;
01781
01782 break;
01783
01784 case OCI_TRC_DETAIL:
01785
01786 #if OCI_VERSION_COMPILE >= OCI_10_1
01787
01788 attrib = OCI_ATTR_CLIENT_INFO;
01789
01790 #endif
01791 con->trace->info[0] = 0;
01792
01793 mtsncat(con->trace->info, value, OCI_SIZE_TRACE_INF0);
01794
01795 str = con->trace->info;
01796
01797 break;
01798
01799 default:
01800
01801 res = FALSE;
01802 }
01803 }
01804
01805 #if OCI_VERSION_COMPILE >= OCI_10_1
01806
01807
01808
01809
01810 if (res == TRUE)
01811 {
01812 void *ostr = NULL;
01813 int osize = -1;
01814
01815 ostr = OCI_GetInputMetaString(str, &osize);
01816
01817 if (str == NULL)
01818 osize = 0;
01819
01820 OCI_CALL2
01821 (
01822 res, con,
01823
01824 OCIAttrSet((dvoid *) con->ses, (ub4) OCI_HTYPE_SESSION,
01825 (dvoid *) ostr, (ub4) osize, attrib, con->err)
01826 )
01827
01828 OCI_ReleaseMetaString(ostr);
01829 }
01830
01831 #endif
01832
01833 OCI_RESULT(res);
01834
01835 return res;
01836 }
01837
01838
01839
01840
01841
01842 const mtext * OCI_API OCI_GetTrace
01843 (
01844 OCI_Connection *con,
01845 unsigned int trace
01846 )
01847 {
01848 const mtext *str = NULL;
01849 boolean res = TRUE;
01850
01851 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);
01852
01853 if (con->trace != NULL)
01854 {
01855 switch (trace)
01856 {
01857 case OCI_TRC_IDENTITY:
01858
01859 str = con->trace->identifier;
01860 break;
01861
01862 case OCI_TRC_MODULE:
01863
01864 str = con->trace->module;
01865 break;
01866
01867 case OCI_TRC_ACTION:
01868
01869 str = con->trace->action;
01870 break;
01871
01872 case OCI_TRC_DETAIL:
01873
01874 str = con->trace->info;
01875 break;
01876
01877 default:
01878
01879 res = FALSE;
01880 }
01881 }
01882
01883 OCI_RESULT(res);
01884
01885 return str;
01886 }
01887
01888
01889
01890
01891
01892 boolean OCI_API OCI_Ping
01893 (
01894 OCI_Connection *con
01895 )
01896 {
01897 boolean res = TRUE;
01898 boolean ret = FALSE;
01899
01900 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, FALSE);
01901
01902 #if OCI_VERSION_COMPILE >= OCI_10_2
01903
01904 if (OCILib.version_runtime >= OCI_10_2)
01905 {
01906 OCI_CALL2
01907 (
01908 res, con,
01909
01910 OCIPing(con->cxt, con->err, (ub4) OCI_DEFAULT)
01911
01912 )
01913
01914 ret = res;
01915 }
01916
01917 #endif
01918
01919 OCI_RESULT(res);
01920
01921 return ret;
01922 }
01923