• Main Page
  • Modules
  • Data Structures
  • Files
  • File List

D:/Perso/dev/ocilib/ocilib/src/exception.c

00001 /*
00002     +-----------------------------------------------------------------------------------------+
00003     |                                                                                         |
00004     |                               OCILIB - C Driver for Oracle                              |
00005     |                                                                                         |
00006     |                                (C Wrapper for Oracle OCI)                               |
00007     |                                                                                         |
00008     |                              Website : http://www.ocilib.net                            |
00009     |                                                                                         |
00010     |             Copyright (c) 2007-2010 Vincent ROGIER <vince.rogier@ocilib.net>            |
00011     |                                                                                         |
00012     +-----------------------------------------------------------------------------------------+
00013     |                                                                                         |
00014     |             This library is free software; you can redistribute it and/or               |
00015     |             modify it under the terms of the GNU Lesser General Public                  |
00016     |             License as published by the Free Software Foundation; either                |
00017     |             version 2 of the License, or (at your option) any later version.            |
00018     |                                                                                         |
00019     |             This library is distributed in the hope that it will be useful,             |
00020     |             but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00021     |             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           |
00022     |             Lesser General Public License for more details.                             |
00023     |                                                                                         |
00024     |             You should have received a copy of the GNU Lesser General Public            |
00025     |             License along with this library; if not, write to the Free                  |
00026     |             Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.          |
00027     |                                                                                         |
00028     +-----------------------------------------------------------------------------------------+
00029 */
00030 
00031 /* --------------------------------------------------------------------------------------------- *
00032  * $Id: exception.c, v 3.8.0 2010-10-24 21:53 Vincent Rogier $
00033  * --------------------------------------------------------------------------------------------- */
00034 
00035 #include "ocilib_internal.h"
00036 
00037 /* ********************************************************************************************* *
00038  *                            STRINGS MESSAGES
00039  * ********************************************************************************************* */
00040 
00041 static mtext * OCILib_TypeNames[] =
00042 {
00043     MT("generic pointer"),
00044     MT("short pointer"),
00045     MT("int pointer"),
00046     MT("big_int pointer"),
00047     MT("double pointer"),
00048     MT("string pointer"),
00049     MT("function callback"),
00050 
00051     MT("Error handle"),
00052     MT("Schema handle"),
00053     MT("Connection handle"),
00054     MT("Pool handle"),
00055     MT("Transaction handle"),
00056     MT("Statement handle"),
00057     MT("Resultset handle"),
00058     MT("Column handle"),
00059     MT("Date handle"),
00060     MT("Timestamp handle"),
00061     MT("Interval handle"),
00062     MT("Lob handle"),
00063     MT("File handle"),
00064     MT("Long handle"),
00065     MT("Object handle"),
00066     MT("Collection handle"),
00067     MT("Collection iterator handle"),
00068     MT("Collection element handle"),
00069     MT("Hash Table handle"),
00070     MT("Thread handle"),
00071     MT("Mutex handle"),
00072     MT("Bind handle"),
00073     MT("Ref handle"),
00074     MT("Direct Path handle"),
00075     MT("Subscription handle"),
00076     MT("Event handle"),
00077     MT("Array handle"),
00078     MT("Message handle"),
00079     MT("Enqueue handle"),
00080     MT("Dequeue handle"),
00081     MT("Agent handle"),
00082 
00083     MT("Internal list handle"),
00084     MT("Internal list item handle"),
00085     MT("Internal array of bind handles"),
00086     MT("Internal define handle"),
00087     MT("Internal array of define handles"),
00088     MT("Internal hash entry handle"),
00089     MT("Internal array of hash entry handles"),
00090     MT("Internal hash value handle"),
00091     MT("Internal thread key handle"),
00092     MT("Internal Oracle date handle"),
00093     MT("Internal C tm structure"),
00094     MT("Internal array of resultset handles"),
00095     MT("Internal array of PL/SQL sizes integers"),
00096     MT("Internal array of PL/SQL return codes integers"),
00097     MT("Internal server output handle"),
00098     MT("Internal array of indicator integers"),
00099     MT("Internal array of buffer length integers"),
00100     MT("Internal array of data buffers"),
00101     MT("Internal Long handle data buffer"),
00102     MT("Internal trace info structure"),
00103     MT("Internal array of direct path columns"),
00104     MT("Internal array of batch error objects")
00105 };
00106 
00107 #if defined(OCI_CHARSET_WIDE) && !defined(_MSC_VER)
00108 
00109 static mtext * OCILib_ErrorMsg[] =
00110 {
00111     MT("No error"),
00112     MT("OCILIB has not been initialized"),
00113     MT("Cannot load OCI shared library (%ls)"),
00114     MT("Cannot load OCI symbols from shared library"),
00115     MT("OCILIB has not been initialized in multithreaded mode"),
00116     MT("Memory allocation failure (type %ls, size : %d)"),
00117     MT("Feature not available (%ls) "),
00118     MT("A null %ls has been provided"),
00119     MT("Oracle datatype (sqlcode %d) not supported for this operation "),
00120     MT("Unknown identifier %c while parsing SQL"),
00121     MT("Unknown argument %d while retrieving data"),
00122     MT("Index %d out of bounds"),
00123     MT("Found %d unfreed %ls"),
00124     MT("Maximum number of binds (%d) already reached"),
00125     MT("Object attribute '%ls' not found"),
00126     MT("The integer parameter value must be at least %d"),
00127     MT("Elements are not compatible"),
00128     MT("Unable to perform this operation on a %ls statement"),
00129     MT("The statement is not scrollable"),
00130     MT("Name or position '%ls' already binded to the statement"),
00131     MT("Invalid new size for bind arrays (initial %d, current %d, new %d)"),
00132     MT("Column '%ls' not find in table '%ls'"),
00133     MT("Unable to perform this operation on a %ls direct path process"),
00134     MT("Cannot create OCI environment")
00135 };
00136 
00137 #else
00138 
00139 static mtext * OCILib_ErrorMsg[] =
00140 {
00141     MT("No error"),
00142     MT("OCILIB has not been initialized"),
00143     MT("Cannot load OCI shared library (%s)"),
00144     MT("Cannot load OCI symbols from shared library"),
00145     MT("OCILIB has not been initialized in multithreaded mode"),
00146     MT("Memory allocation failure (type %s, size : %d)"),
00147     MT("Feature not available (%s) "),
00148     MT("A null %s has been provided"),
00149     MT("Oracle datatype (sqlcode %d) not supported for this operation "),
00150     MT("Unknown identifier %c while parsing SQL : "),
00151     MT("Unknown argument %d while retrieving data"),
00152     MT("Index %d out of bounds"),
00153     MT("Found %d unfreed %s"),
00154     MT("Maximum number of binds (%d) already reached"),
00155     MT("Object attribute '%s' not found"),
00156     MT("The integer parameter value must be at least %d"),
00157     MT("Elements are not compatible"),
00158     MT("Unable to perform this operation on a %s statement"),
00159     MT("The statement is not scrollable"),
00160     MT("Name or position '%s' already binded to the statement"),
00161     MT("Invalid new size for bind arrays (initial %d, current %d, new %d)"),
00162     MT("Column '%s' not find in table '%s'"),
00163     MT("Unable to perform this operation on a %s direct path process"),
00164     MT("Cannot create OCI environment")
00165 };
00166 
00167 #endif
00168 
00169 static mtext * OCILib_OraFeatures[] =
00170 {
00171     MT("Oracle 9.0 support for Unicode data"),
00172     MT("Oracle 9.0 Timestamps and Intervals"),
00173     MT("Oracle 9.2 Direct path date caching"),
00174     MT("Oracle 10g R1 LOBs size extensions"),
00175     MT("Oracle 10g R2 Database change notification"),
00176     MT("Oracle 10g R2 remote database startup/shutdown")
00177 };
00178 
00179 static mtext * OCILib_StmtStates[] =
00180 {
00181     MT("closed"),
00182     MT("prepared"),
00183     MT("executed")
00184 };
00185 
00186 static mtext * OCILib_DirPathStates[] =
00187 {
00188     MT("non prepared"),
00189     MT("prepared"),
00190     MT("converted"),
00191     MT("terminated")
00192 };
00193 
00194 static mtext * OCILib_HandleNames[] =
00195 {
00196     MT("OCI handle"),
00197     MT("OCI descriptors"),
00198     MT("OCI Object handles")
00199 };
00200 
00201 /* ********************************************************************************************* *
00202  *                             PRIVATE FUNCTIONS
00203  * ********************************************************************************************* */
00204 
00205 /* --------------------------------------------------------------------------------------------- *
00206  * OCI_ExceptionGetError
00207  * --------------------------------------------------------------------------------------------- */
00208 
00209 OCI_Error * OCI_ExceptionGetError
00210 (
00211     boolean warning
00212 )
00213 {
00214     OCI_Error *err = OCI_ErrorGet(TRUE, warning);
00215 
00216     if (err != NULL)
00217     {
00218         OCI_ErrorReset(err);
00219 
00220         err->active  = TRUE;
00221         err->warning = warning;
00222     }
00223 
00224     return err;
00225 }
00226 
00227 /* --------------------------------------------------------------------------------------------- *
00228  * OCI_ExceptionRaise
00229  * --------------------------------------------------------------------------------------------- */
00230 
00231 void OCI_ExceptionRaise
00232 (
00233     OCI_Error *err
00234 )
00235 {
00236     if (err != NULL)
00237     {
00238         if (OCILib.error_handler != NULL)
00239             OCILib.error_handler(err);
00240 
00241         err->active = FALSE;
00242     }
00243 }
00244 
00245 /* --------------------------------------------------------------------------------------------- *
00246  * OCI_ExceptionOCI
00247  * --------------------------------------------------------------------------------------------- */
00248 
00249 void OCI_ExceptionOCI
00250 (
00251     OCIError       *p_err,
00252     OCI_Connection *con,
00253     OCI_Statement  *stmt,
00254     boolean         warning
00255 )
00256 {
00257     OCI_Error *err = OCI_ExceptionGetError(warning);
00258 
00259     if (err != NULL)
00260     {
00261         int osize  = -1;
00262         void *ostr = NULL;
00263 
00264         err->type = (warning ? OCI_ERR_WARNING : OCI_ERR_ORACLE);
00265         err->con  = con;
00266         err->stmt = stmt;
00267 
00268         /* get oracle description */
00269 
00270         osize = (int) (msizeof(err->str) - (size_t) 1);
00271         ostr  = OCI_GetInputMetaString(err->str, &osize);
00272 
00273         OCIErrorGet((dvoid *) p_err, (ub4) 1, (OraText *) NULL, &err->ocode,
00274                     (OraText *) ostr, (ub4) osize, (ub4) OCI_HTYPE_ERROR);
00275 
00276         OCI_GetOutputMetaString(ostr, err->str, &osize);
00277         OCI_ReleaseMetaString(ostr);
00278     }
00279 
00280     OCI_ExceptionRaise(err);
00281 }
00282 
00283 /* --------------------------------------------------------------------------------------------- *
00284  * OCI_ExceptionNotInitialized
00285  * --------------------------------------------------------------------------------------------- */
00286 
00287 void OCI_ExceptionNotInitialized
00288 (
00289     void
00290 )
00291 {
00292     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00293 
00294     if (err != NULL)
00295     {
00296         err->type  = OCI_ERR_OCILIB;
00297         err->icode = OCI_ERR_NOT_INITIALIZED;
00298 
00299         mtsncat(err->str,  OCILib_ErrorMsg[OCI_ERR_NOT_INITIALIZED],
00300                 msizeof(err->str) - (size_t) 1);
00301     }
00302 
00303     OCI_ExceptionRaise(err);
00304 }
00305 
00306 /* --------------------------------------------------------------------------------------------- *
00307  * OCI_ExceptionLoadingShareLib
00308  * --------------------------------------------------------------------------------------------- */
00309 
00310 void OCI_ExceptionLoadingSharedLib
00311 (
00312     void
00313 )
00314 {
00315     #ifdef OCI_IMPORT_RUNTIME
00316 
00317     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00318 
00319     if (err != NULL)
00320     {
00321         err->type  = OCI_ERR_OCILIB;
00322         err->icode = OCI_ERR_LOADING_SHARED_LIB;
00323 
00324         mtsprintf(err->str, msizeof(err->str) - (size_t) 1,
00325                   OCILib_ErrorMsg[OCI_ERR_LOADING_SHARED_LIB],
00326                   OCI_DL_META_NAME);
00327     }
00328 
00329     OCI_ExceptionRaise(err);
00330 
00331     #endif
00332 }
00333 
00334 /* --------------------------------------------------------------------------------------------- *
00335  * OCI_ExceptionLoadingSymbols
00336  * --------------------------------------------------------------------------------------------- */
00337 
00338 void OCI_ExceptionLoadingSymbols
00339 (
00340     void
00341 )
00342 {
00343     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00344 
00345     if (err != NULL)
00346     {
00347         err->type  = OCI_ERR_OCILIB;
00348         err->icode = OCI_ERR_LOADING_SYMBOLS;
00349 
00350         mtsncat(err->str,  OCILib_ErrorMsg[OCI_ERR_LOADING_SYMBOLS],
00351                 msizeof(err->str) - (size_t) 1);
00352     }
00353 
00354     OCI_ExceptionRaise(err);
00355 }
00356 
00357 /* --------------------------------------------------------------------------------------------- *
00358  * OCI_ExceptionNotMultithreaded
00359  * --------------------------------------------------------------------------------------------- */
00360 
00361 void OCI_ExceptionNotMultithreaded
00362 (
00363     void
00364 )
00365 {
00366     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00367 
00368     if (err != NULL)
00369     {
00370         err->type  = OCI_ERR_OCILIB;
00371         err->icode = OCI_ERR_MULTITHREADED;
00372 
00373         mtsncat(err->str,  OCILib_ErrorMsg[OCI_ERR_MULTITHREADED],
00374                 msizeof(err->str) - (size_t) 1);
00375     }
00376 
00377     OCI_ExceptionRaise(err);
00378 }
00379 
00380 /* --------------------------------------------------------------------------------------------- *
00381  * OCI_ExceptionNullPointer
00382  * --------------------------------------------------------------------------------------------- */
00383 
00384 void OCI_ExceptionNullPointer
00385 (
00386     int type
00387 )
00388 {
00389     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00390 
00391     if (err != NULL)
00392     {
00393         err->type  = OCI_ERR_OCILIB;
00394         err->icode = OCI_ERR_NULL_POINTER;
00395 
00396         mtsprintf(err->str, msizeof(err->str) - (size_t) 1,
00397                   OCILib_ErrorMsg[OCI_ERR_NULL_POINTER],
00398                   OCILib_TypeNames[type-1]);
00399     }
00400 
00401     OCI_ExceptionRaise(err);
00402 }
00403 
00404 /* --------------------------------------------------------------------------------------------- *
00405  * OCI_ExceptionMemory
00406  * --------------------------------------------------------------------------------------------- */
00407 
00408 void OCI_ExceptionMemory
00409 (
00410     int             type,
00411     size_t          nb_bytes,
00412     OCI_Connection *con,
00413     OCI_Statement  *stmt
00414 )
00415 {
00416     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00417 
00418     if (err != NULL)
00419     {
00420         err->type  = OCI_ERR_OCILIB;
00421         err->icode = OCI_ERR_MEMORY;
00422         err->con   = con;
00423         err->stmt  = stmt;
00424 
00425         mtsprintf(err->str,
00426                   msizeof(err->str) - (size_t) 1,
00427                   OCILib_ErrorMsg[OCI_ERR_MEMORY],
00428                   OCILib_TypeNames[type-1],
00429                   nb_bytes);
00430     }
00431 
00432     OCI_ExceptionRaise(err);
00433 }
00434 
00435 /* --------------------------------------------------------------------------------------------- *
00436  * OCI_ExceptionNotAvailable
00437  * --------------------------------------------------------------------------------------------- */
00438 
00439 void OCI_ExceptionNotAvailable
00440 (
00441     OCI_Connection *con,
00442     int             feature
00443 )
00444 {
00445     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00446 
00447     if (err != NULL)
00448     {
00449         err->type  = OCI_ERR_OCILIB;
00450         err->icode = OCI_ERR_NOT_AVAILABLE;
00451         err->con   = con;
00452 
00453         mtsprintf(err->str,
00454                   msizeof(err->str) - (size_t) 1,
00455                   OCILib_ErrorMsg[OCI_ERR_NOT_AVAILABLE],
00456                   OCILib_OraFeatures[feature-1]);
00457     }
00458 
00459     OCI_ExceptionRaise(err);
00460 }
00461 
00462 /* --------------------------------------------------------------------------------------------- *
00463  * OCI_ExceptionDatatypeNotSupported
00464  * --------------------------------------------------------------------------------------------- */
00465 
00466 void OCI_ExceptionDatatypeNotSupported
00467 (
00468     OCI_Connection *con,
00469     OCI_Statement  *stmt,
00470     int             code
00471 )
00472 {
00473     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00474 
00475     if (err != NULL)
00476     {
00477         err->type  = OCI_ERR_OCILIB;
00478         err->icode = OCI_ERR_DATATYPE_NOT_SUPPORTED;
00479         err->con   = con;
00480         err->stmt  = stmt;
00481 
00482         mtsprintf(err->str,
00483                   msizeof(err->str) - (size_t) 1,
00484                   OCILib_ErrorMsg[OCI_ERR_DATATYPE_NOT_SUPPORTED],
00485                   code);
00486     }
00487 
00488     OCI_ExceptionRaise(err);
00489 }
00490 
00491 /* --------------------------------------------------------------------------------------------- *
00492  * OCI_ExceptionParsingError
00493  * --------------------------------------------------------------------------------------------- */
00494 
00495 void OCI_ExceptionParsingToken
00496 (
00497     OCI_Connection *con,
00498     OCI_Statement  *stmt,
00499     mtext           token
00500 )
00501 {
00502     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00503 
00504     if (err != NULL)
00505     {
00506         err->type  = OCI_ERR_OCILIB;
00507         err->icode = OCI_ERR_PARSE_TOKEN;
00508         err->con   = con;
00509         err->stmt  = stmt;
00510 
00511         mtsprintf(err->str,
00512                   msizeof(err->str) - (size_t) 1,
00513                   OCILib_ErrorMsg[OCI_ERR_PARSE_TOKEN],
00514                   token);
00515     }
00516 
00517     OCI_ExceptionRaise(err);
00518 }
00519 
00520 /* --------------------------------------------------------------------------------------------- *
00521  * OCI_ExceptionMappingArgument
00522  * --------------------------------------------------------------------------------------------- */
00523 
00524 void OCI_ExceptionMappingArgument
00525 (
00526     OCI_Connection *con,
00527     OCI_Statement  *stmt,
00528     int             arg
00529 )
00530 {
00531     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00532 
00533     if (err != NULL)
00534     {
00535         err->type  = OCI_ERR_OCILIB;
00536         err->icode = OCI_ERR_MAP_ARGUMENT;
00537         err->con   = con;
00538         err->stmt  = stmt;
00539 
00540         mtsprintf(err->str,
00541                   msizeof(err->str) - (size_t) 1,
00542                   OCILib_ErrorMsg[OCI_ERR_MAP_ARGUMENT],
00543                   arg);
00544     }
00545 
00546     OCI_ExceptionRaise(err);
00547 }
00548 
00549 /* --------------------------------------------------------------------------------------------- *
00550  * OCI_ExceptionOutOfBounds
00551  * --------------------------------------------------------------------------------------------- */
00552 
00553 void OCI_ExceptionOutOfBounds
00554 (
00555     OCI_Connection *con,
00556     int             value
00557 )
00558 {
00559     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00560 
00561     if (err != NULL)
00562     {
00563         err->type  = OCI_ERR_OCILIB;
00564         err->icode = OCI_ERR_OUT_OF_BOUNDS;
00565         err->con   = con;
00566 
00567         mtsprintf(err->str,
00568                   msizeof(err->str) - (size_t) 1,
00569                   OCILib_ErrorMsg[OCI_ERR_OUT_OF_BOUNDS],
00570                   value);
00571     }
00572 
00573     OCI_ExceptionRaise(err);
00574 }
00575 
00576 /* --------------------------------------------------------------------------------------------- *
00577 * OCI_ExceptionUnfreedData
00578 * --------------------------------------------------------------------------------------------- */
00579 
00580 void OCI_ExceptionUnfreedData
00581 (
00582     int type_elem,
00583     int nb_elem
00584 )
00585 {
00586     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00587 
00588     if (err != NULL)
00589     {
00590         err->type  = OCI_ERR_OCILIB;
00591         err->icode = OCI_ERR_UNFREED_DATA;
00592 
00593         mtsprintf(err->str,
00594                   msizeof(err->str) - (size_t) 1,
00595                   OCILib_ErrorMsg[OCI_ERR_UNFREED_DATA],
00596                   nb_elem, OCILib_HandleNames[type_elem-1]);
00597     }
00598 
00599     OCI_ExceptionRaise(err);
00600 }
00601 
00602 /* --------------------------------------------------------------------------------------------- *
00603  * OCI_ExceptionRuntimeLoading
00604  * --------------------------------------------------------------------------------------------- */
00605 
00606 void OCI_ExceptionMaxBind
00607 (
00608     OCI_Statement *stmt
00609 )
00610 {
00611     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00612 
00613     if (err != NULL)
00614     {
00615         err->type  = OCI_ERR_OCILIB;
00616         err->icode = OCI_ERR_MAX_BIND;
00617         err->stmt  = stmt;
00618 
00619         if (stmt != NULL)
00620             err->con =  stmt->con;
00621 
00622         mtsprintf(err->str,
00623                   msizeof(err->str) - (size_t) 1,
00624                   OCILib_ErrorMsg[OCI_ERR_MAX_BIND],
00625                   OCI_BIND_MAX);
00626     }
00627 
00628     OCI_ExceptionRaise(err);
00629 }
00630 
00631 /* --------------------------------------------------------------------------------------------- *
00632  * OCI_ExceptionAttributeNotFound
00633  * --------------------------------------------------------------------------------------------- */
00634 
00635 void OCI_ExceptionAttributeNotFound
00636 (
00637     OCI_Connection *con,
00638     const mtext    *attr
00639 )
00640 {
00641     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00642 
00643     if (err != NULL)
00644     {
00645         err->type  = OCI_ERR_OCILIB;
00646         err->icode = OCI_ERR_ATTR_NOT_FOUND;
00647         err->con   = con;
00648 
00649         mtsprintf(err->str,
00650                   msizeof(err->str) - (size_t) 1,
00651                   OCILib_ErrorMsg[OCI_ERR_ATTR_NOT_FOUND],
00652                   attr);
00653     }
00654 
00655     OCI_ExceptionRaise(err);
00656 }
00657 
00658 /* --------------------------------------------------------------------------------------------- *
00659  * OCI_ExceptionMinimumValue
00660  * --------------------------------------------------------------------------------------------- */
00661 
00662 void OCI_ExceptionMinimumValue
00663 (
00664     OCI_Connection *con,
00665     OCI_Statement  *stmt,
00666     int             min
00667 )
00668 {
00669     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00670 
00671     if (err != NULL)
00672     {
00673         err->type  = OCI_ERR_OCILIB;
00674         err->icode = OCI_ERR_MIN_VALUE;
00675         err->con   = con;
00676         err->stmt  = stmt;
00677         mtsprintf(err->str, msizeof(err->str) - (size_t) 1,
00678                   OCILib_ErrorMsg[OCI_ERR_MIN_VALUE], min);
00679     }
00680 
00681     OCI_ExceptionRaise(err);
00682 }
00683 
00684 /* --------------------------------------------------------------------------------------------- *
00685  * OCI_ExceptionTypeNotCompatible
00686  * --------------------------------------------------------------------------------------------- */
00687 
00688 void OCI_ExceptionTypeNotCompatible
00689 (
00690     OCI_Connection *con
00691 )
00692 {
00693     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00694 
00695     if (err != NULL)
00696     {
00697         err->type  = OCI_ERR_OCILIB;
00698         err->icode = OCI_ERR_NOT_COMPATIBLE;
00699         err->con   = con;
00700 
00701         mtsncat(err->str, OCILib_ErrorMsg[OCI_ERR_NOT_COMPATIBLE],
00702                 msizeof(err->str) - (size_t) 1);
00703     }
00704 
00705     OCI_ExceptionRaise(err);
00706 }
00707 
00708 /* --------------------------------------------------------------------------------------------- *
00709  * OCI_ExceptionStatementState
00710  * --------------------------------------------------------------------------------------------- */
00711 
00712 void OCI_ExceptionStatementState
00713 (
00714     OCI_Statement *stmt,
00715     int            state
00716 )
00717 {
00718     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00719 
00720     if (err != NULL)
00721     {
00722         err->type  = OCI_ERR_OCILIB;
00723         err->icode = OCI_ERR_STMT_STATE;
00724         err->stmt  = stmt;
00725 
00726         if (stmt != NULL)
00727             err->con =  stmt->con;
00728 
00729         mtsprintf(err->str,
00730                   msizeof(err->str) - (size_t) 1,
00731                   OCILib_ErrorMsg[OCI_ERR_STMT_STATE],
00732                   OCILib_StmtStates[state-1]);
00733     }
00734 
00735     OCI_ExceptionRaise(err);
00736 }
00737 
00738 /* --------------------------------------------------------------------------------------------- *
00739  * OCI_ExceptionStatementNotScrollable
00740  * --------------------------------------------------------------------------------------------- */
00741 
00742 void OCI_ExceptionStatementNotScrollable
00743 (
00744     OCI_Statement *stmt
00745 )
00746 {
00747     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00748 
00749     if (err != NULL)
00750     {
00751         err->type  = OCI_ERR_OCILIB;
00752         err->icode = OCI_ERR_STMT_NOT_SCROLLABLE;
00753         err->stmt  = stmt;
00754 
00755         if (stmt != NULL)
00756             err->con =  stmt->con;
00757 
00758         mtsncat(err->str, OCILib_ErrorMsg[OCI_ERR_STMT_NOT_SCROLLABLE],
00759                 msizeof(err->str) - (size_t) 1);
00760 
00761     }
00762 
00763     OCI_ExceptionRaise(err);
00764 }
00765 
00766 /* --------------------------------------------------------------------------------------------- *
00767  * OCI_ExceptionBindAlreadyUsed
00768  * --------------------------------------------------------------------------------------------- */
00769 
00770 void OCI_ExceptionBindAlreadyUsed
00771 (
00772     OCI_Statement *stmt,
00773     const mtext  * bind
00774 )
00775 {
00776     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00777 
00778     if (err != NULL)
00779     {
00780         err->type  = OCI_ERR_OCILIB;
00781         err->icode = OCI_ERR_BIND_ALREADY_USED;
00782         err->stmt  = stmt;
00783 
00784         if (stmt != NULL)
00785             err->con =  stmt->con;
00786 
00787         mtsprintf(err->str,
00788                   msizeof(err->str) - (size_t) 1,
00789                   OCILib_ErrorMsg[OCI_ERR_BIND_ALREADY_USED],
00790                   bind);
00791     }
00792 
00793     OCI_ExceptionRaise(err);
00794 }
00795 
00796 /* --------------------------------------------------------------------------------------------- *
00797  * OCI_ExceptionBindArraySize
00798  * --------------------------------------------------------------------------------------------- */
00799 
00800 void OCI_ExceptionBindArraySize
00801 (
00802     OCI_Statement *stmt,
00803     unsigned int   maxsize,
00804     unsigned int   cursize,
00805     unsigned int   newsize
00806 )
00807 {
00808     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00809 
00810     if (err != NULL)
00811     {
00812         err->type  = OCI_ERR_OCILIB;
00813         err->icode = OCI_ERR_BIND_ARRAY_SIZE;
00814         err->stmt  = stmt;
00815 
00816         if (stmt != NULL)
00817             err->con =  stmt->con;
00818 
00819         mtsprintf(err->str,
00820                   msizeof(err->str) - (size_t) 1,
00821                   OCILib_ErrorMsg[OCI_ERR_BIND_ARRAY_SIZE],
00822                   maxsize, cursize, newsize);
00823     }
00824 
00825     OCI_ExceptionRaise(err);
00826 }
00827 
00828 /* --------------------------------------------------------------------------------------------- *
00829  * OCI_ExceptionDirPathColNotFound
00830  * --------------------------------------------------------------------------------------------- */
00831 
00832 void OCI_ExceptionDirPathColNotFound
00833 (
00834     OCI_DirPath  *dp,
00835     const mtext * column,
00836     const mtext  *table
00837 )
00838 {
00839     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00840 
00841     if (err != NULL)
00842     {
00843         err->type  = OCI_ERR_OCILIB;
00844         err->icode = OCI_ERR_DIRPATH_STATE;
00845         err->stmt  = NULL;
00846 
00847         if (dp != NULL)
00848             dp->con =  dp->con;
00849 
00850         mtsprintf(err->str,
00851                   msizeof(err->str) - (size_t) 1,
00852                   OCILib_ErrorMsg[OCI_ERR_COLUMN_NOT_FOUND],
00853                   column,
00854                   table);
00855     }
00856 
00857     OCI_ExceptionRaise(err);
00858 }
00859 
00860 /* --------------------------------------------------------------------------------------------- *
00861  * OCI_ExceptionDirPathState
00862  * --------------------------------------------------------------------------------------------- */
00863 
00864 void OCI_ExceptionDirPathState
00865 (
00866     OCI_DirPath *dp,
00867     int          state
00868 )
00869 {
00870     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00871 
00872     if (err != NULL)
00873     {
00874         err->type  = OCI_ERR_OCILIB;
00875         err->icode = OCI_ERR_DIRPATH_STATE;
00876         err->stmt  = NULL;
00877 
00878         if (dp != NULL)
00879             dp->con =  dp->con;
00880 
00881         mtsprintf(err->str,
00882                   msizeof(err->str) - (size_t) 1,
00883                   OCILib_ErrorMsg[OCI_ERR_DIRPATH_STATE],
00884                   OCILib_DirPathStates[state-1]);
00885     }
00886 
00887     OCI_ExceptionRaise(err);
00888 }
00889 
00890 /* --------------------------------------------------------------------------------------------- *
00891  * OCI_ExceptionOCIEnvironment
00892  * --------------------------------------------------------------------------------------------- */
00893 
00894 void OCI_ExceptionOCIEnvironment
00895 (
00896     void
00897 )
00898 {
00899     OCI_Error *err = OCI_ExceptionGetError(FALSE);
00900 
00901     if (err != NULL)
00902     {
00903         err->type  = OCI_ERR_OCILIB;
00904         err->icode = OCI_ERR_CREATE_OCI_ENVIRONMENT;
00905 
00906         mtsncat(err->str,  OCILib_ErrorMsg[OCI_ERR_CREATE_OCI_ENVIRONMENT],
00907                 msizeof(err->str) - (size_t) 1);
00908     }
00909 
00910     OCI_ExceptionRaise(err);
00911 }
00912 

Generated on Sun Oct 24 2010 22:02:54 for OCILIB (C Driver for Oracle) by  doxygen 1.7.1