📄 exception.c
字号:
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_NULL_POINTER;
mtsprintf(err->str, msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_NULL_POINTER],
OCILib_TypeNames[type-1]);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionMemory
* ------------------------------------------------------------------------ */
void OCI_ExceptionMemory(int type, size_t nb_bytes, OCI_Connection *con,
OCI_Statement *stmt)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_MEMORY;
err->con = con;
err->stmt = stmt;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_MEMORY],
OCILib_TypeNames[type-1],
nb_bytes);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionNotAvailable
* ------------------------------------------------------------------------ */
void OCI_ExceptionNotAvailable(OCI_Connection *con, int feature)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_NOT_AVAILABLE;
err->con = con;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_NOT_AVAILABLE],
OCILib_OraFeatures[feature-1]);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionNotSupported
* ------------------------------------------------------------------------ */
void OCI_ExceptionNotSupported(OCI_Connection *con, OCI_Statement *stmt, int code)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_NOT_SUPPORTED;
err->con = con;
err->stmt = stmt;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_NOT_SUPPORTED],
code);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionParsingError
* ------------------------------------------------------------------------ */
void OCI_ExceptionParsingToken(OCI_Connection *con, OCI_Statement *stmt, mtext token)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_PARSE_TOKEN;
err->con = con;
err->stmt = stmt;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_PARSE_TOKEN],
token);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionMappingArgument
* ------------------------------------------------------------------------ */
void OCI_ExceptionMappingArgument(OCI_Connection *con, OCI_Statement *stmt,
int arg)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_MAP_ARGUMENT;
err->con = con;
err->stmt = stmt;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_MAP_ARGUMENT],
arg);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionOutOfBounds
* ------------------------------------------------------------------------ */
void OCI_ExceptionOutOfBounds(OCI_Connection *con, int value, int lb, int ub)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_OUT_OF_BOUNDS;
err->con = con;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_OUT_OF_BOUNDS],
value, lb, ub);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionUnfreedData
* ------------------------------------------------------------------------ */
void OCI_ExceptionUnfreedData(int type_elem, int nb_elem)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_UNFREED_DATA;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_UNFREED_DATA],
nb_elem, OCILib_HandleNames[type_elem-1]);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionRuntimeLoading
* ------------------------------------------------------------------------ */
void OCI_ExceptionMaxBind(OCI_Statement *stmt)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_MAX_BIND;
err->stmt = stmt;
if (stmt != NULL)
err->con = stmt->con;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_MAX_BIND],
OCI_BIND_MAX);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionAttributeNotFound
* ------------------------------------------------------------------------ */
void OCI_ExceptionAttributeNotFound(OCI_Connection *con, const mtext *attr)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_ATTR_NOT_FOUND;
err->con = con;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_ATTR_NOT_FOUND],
attr);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionMinimumValue
* ------------------------------------------------------------------------ */
void OCI_ExceptionMinimumValue(OCI_Connection *con, OCI_Statement *stmt, int min)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_MIN_VALUE;
err->con = con;
err->stmt = stmt;
mtsprintf(err->str, msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_MIN_VALUE], min);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionTypeNotCompatible
* ------------------------------------------------------------------------ */
void OCI_ExceptionTypeNotCompatible(OCI_Connection *con, int type1, int type2)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_NOT_COMPATIBLE;
err->con = con;
mtsprintf(err->str, msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_NOT_COMPATIBLE], type1, type2);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionStatementState
* ------------------------------------------------------------------------ */
void OCI_ExceptionStatementState(OCI_Statement *stmt, int state)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_STMT_STATE;
err->stmt = stmt;
if (stmt != NULL)
err->con = stmt->con;
mtsprintf(err->str,
msizeof(err->str) - 1,
OCILib_ErrorMsg[OCI_ERR_STMT_STATE],
OCILib_StmtStates[state-1]);
}
OCI_ExceptionRaise(err);
}
/* ------------------------------------------------------------------------ *
* OCI_ExceptionStatementNotScrollable
* ------------------------------------------------------------------------ */
void OCI_ExceptionStatementNotScrollable(OCI_Statement *stmt)
{
OCI_Error *err = OCI_ExceptionGetError();
if (err != NULL)
{
err->type = OCI_ERR_OCILIB;
err->icode = OCI_ERR_STMT_NOT_SCROLLABLE;
err->stmt = stmt;
if (stmt != NULL)
err->con = stmt->con;
mtsncat(err->str, OCILib_ErrorMsg[OCI_ERR_STMT_NOT_SCROLLABLE],
msizeof(err->str) - 1);
}
OCI_ExceptionRaise(err);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -