本文整理汇总了C++中OCI_CHECK_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ OCI_CHECK_PTR函数的具体用法?C++ OCI_CHECK_PTR怎么用?C++ OCI_CHECK_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCI_CHECK_PTR函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OCI_LIB_CALL_ENTER
boolean OCI_API OCI_DateGetTime
(
OCI_Date *date,
int *hour,
int *min,
int *sec
)
{
ub1 hr = 0;
ub1 mn = 0;
ub1 sc = 0;
OCI_LIB_CALL_ENTER(boolean, FALSE)
OCI_CHECK_PTR(OCI_IPC_DATE, date)
OCI_CHECK_PTR(OCI_IPC_INT, hour)
OCI_CHECK_PTR(OCI_IPC_INT, min)
OCI_CHECK_PTR(OCI_IPC_INT, sec)
OCIDateGetTime(date->handle, &hr, &mn, &sc);
*hour = (int) hr;
*min = (int) mn;
*sec = (int) sc;
call_retval = call_status = TRUE;
OCI_LIB_CALL_EXIT()
}
示例2: OCI_CHECK_PTR
boolean OCI_API OCI_MsgGetRaw
(
OCI_Msg *msg,
void *raw,
unsigned int *size
)
{
unsigned int raw_size = 0;
OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE);
OCI_CHECK_PTR(OCI_IPC_VOID, raw, FALSE);
OCI_CHECK_PTR(OCI_IPC_VOID, size, FALSE);
OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode == OCI_UNKNOWN, FALSE);
if ((msg->payload != NULL) && (msg->ind != OCI_IND_NULL))
{
raw_size = OCIRawSize(msg->typinf->con->env, (OCIRaw *) msg->payload);
if (*size > raw_size)
{
*size = raw_size;
}
memcpy(raw, OCIRawPtr(msg->typinf->con->env, msg->payload), (size_t) (*size));
}
else
{
*size = 0;
}
OCI_RESULT(TRUE);
return TRUE;
}
示例3: OCI_LIB_CALL_ENTER
OCI_HashEntry * OCI_API OCI_HashLookup
(
OCI_HashTable *table,
const otext *key,
boolean create
)
{
OCI_HashEntry *e = NULL, *e1 = NULL, *e2 = NULL;
unsigned int i;
OCI_LIB_CALL_ENTER(OCI_HashEntry*, NULL)
OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table)
OCI_CHECK_PTR(OCI_IPC_STRING, key)
i = OCI_HashCompute(table, key);
if (i < table->size)
{
for(e = table->items[i]; e; e = e->next)
{
if (ostrcasecmp(e->key, key) == 0)
{
break;
}
}
if (!e && create)
{
e = (OCI_HashEntry *) OCI_MemAlloc(OCI_IPC_HASHENTRY, sizeof(*e), (size_t) 1, TRUE);
if (e)
{
e->key = ostrdup(key);
e1 = e2 = table->items[i];
while (e1)
{
e2 = e1;
e1 = e1->next;
}
if (e2)
{
e2->next = e;
}
else
{
table->items[i] = e;
}
}
}
}
call_retval = e;
call_status = TRUE;
OCI_LIB_CALL_EXIT()
}
示例4: OCI_IntervalAssign2
/* ------------------------------------------------------------------------ *
* OCI_IntervalAssign
* ------------------------------------------------------------------------ */
boolean OCI_API OCI_IntervalAssign2(OCI_Library *pOCILib, OCI_Interval *itv, OCI_Interval *itv_src, ExceptionSink* xsink)
{
boolean res = TRUE;
OCI_CHECK_PTR(pOCILib, OCI_IPC_INTERVAL, itv, FALSE);
OCI_CHECK_PTR(pOCILib, OCI_IPC_INTERVAL, itv_src, FALSE);
OCI_CHECK_INTERVAL_ENABLED(pOCILib, itv->con, FALSE, xsink);
#if OCI_VERSION_COMPILE >= OCI_9_0
OCI_CALL4Q
(
pOCILib, res, itv->err, itv->con,
OCIIntervalAssign((dvoid *) pOCILib->env, itv->err,
itv_src->handle, itv->handle),
xsink
)
#endif
OCI_RESULT(pOCILib, res);
return res;
}
示例5: OCI_CHECK_PTR
OCI_HashEntry * OCI_API OCI_HashLookup
(
OCI_HashTable *table,
const mtext *key,
boolean create
)
{
OCI_HashEntry *e = NULL, *e1 = NULL, *e2 = NULL;
unsigned int i;
OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, NULL);
OCI_CHECK_PTR(OCI_IPC_STRING, key, NULL);
i = OCI_HashCompute(table, key);
if (i < table->size)
{
for(e = table->items[i]; e != NULL; e = e->next)
{
if (mtscasecmp(e->key, key) == 0)
{
break;
}
}
if ((e == NULL) && (create == TRUE))
{
e = (OCI_HashEntry *) OCI_MemAlloc(OCI_IPC_HASHENTRY, sizeof(*e), (size_t) 1, TRUE);
if (e != NULL)
{
e->key = mtsdup(key);
e1 = e2 = table->items[i];
while (e1 != NULL)
{
e2 = e1;
e1 = e1->next;
}
if (e2 != NULL)
{
e2->next = e;
}
else
{
table->items[i] = e;
}
}
}
}
OCI_RESULT(e != NULL);
return e;
}
示例6: OCI_CHECK_PTR
boolean OCI_API OCI_EnqueuePut
(
OCI_Library *pOCILib,
OCI_Enqueue *enqueue,
OCI_Msg *msg,
ExceptionSink *xsink
)
{
boolean res = TRUE;
void *ostr = NULL;
int osize = -1;
void *payload = NULL;
void *ind = NULL;
OCI_CHECK_PTR(pOCILib, OCI_IPC_ENQUEUE, enqueue, FALSE);
OCI_CHECK_PTR(pOCILib, OCI_IPC_MSG, msg, FALSE);
OCI_CHECK_COMPAT(pOCILib, enqueue->typinf->con, enqueue->typinf->tdo == msg->typinf->tdo, FALSE);
ostr = OCI_GetInputMetaString(pOCILib, enqueue->name, &osize);
/* get payload */
if (enqueue->typinf->tcode != OCI_UNKNOWN)
{
if (msg->ind != OCI_IND_NULL)
{
payload = msg->obj->handle;
ind = msg->obj->tab_ind;
}
}
else
{
payload = msg->payload;
ind = &msg->ind;
}
/* enqueue message */
OCI_CALL2Q
(
pOCILib, res, enqueue->typinf->con,
OCIAQEnq(enqueue->typinf->con->cxt, pOCILib->err,
(OraText*)ostr, enqueue->opth, msg->proph, enqueue->typinf->tdo,
&payload, &ind, NULL, OCI_DEFAULT),
xsink
)
OCI_ReleaseMetaString(ostr);
OCI_RESULT(pOCILib, res);
return res;
}
示例7: sizeof
boolean OCI_API OCI_DateToText
(
OCI_Date *date,
const otext *fmt,
int size,
otext *str
)
{
dbtext *dbstr1 = NULL;
dbtext *dbstr2 = NULL;
int dbsize1 = size * (int) sizeof(otext);
int dbsize2 = -1;
OCI_LIB_CALL_ENTER(boolean, FALSE)
OCI_CHECK_PTR(OCI_IPC_DATE, date)
OCI_CHECK_PTR(OCI_IPC_STRING, str)
/* initialize output buffer in case of OCI failure */
str[0] = 0;
if (!fmt || !fmt[0])
{
fmt = OCI_GetFormat(date->con, OCI_FMT_DATE);
}
dbstr1 = OCI_StringGetOracleString(str, &dbsize1);
dbstr2 = OCI_StringGetOracleString(fmt, &dbsize2);
call_status = TRUE;
OCI_CALL4
(
call_status, date->err, date->con,
OCIDateToText(date->err, date->handle, (oratext *) dbstr2,
(ub1) dbsize2, (oratext *) NULL, (ub4) 0,
(ub4*) &dbsize1, (oratext *) dbstr1)
)
OCI_StringCopyOracleStringToNativeString(dbstr1, str, dbcharcount(dbsize1));
OCI_StringReleaseOracleString(dbstr1);
OCI_StringReleaseOracleString(dbstr2);
/* set null string terminator */
str[dbcharcount(dbsize1)] = 0;
call_retval = call_status;
OCI_LIB_CALL_EXIT()
}
示例8: OCI_LIB_CALL_ENTER
boolean OCI_API OCI_QueueStart
(
OCI_Connection *con,
const otext *queue_name,
boolean enqueue,
boolean dequeue
)
{
OCI_Statement *st = NULL;
OCI_LIB_CALL_ENTER(boolean, FALSE)
OCI_CHECK_PTR(OCI_IPC_CONNECTION, con)
OCI_CHECK_PTR(OCI_IPC_STRING, queue_name)
st = OCI_StatementCreate(con);
if (st)
{
call_status = OCI_Prepare
(
st,
OTEXT("DECLARE ")
OTEXT(" v_enqueue BOOLEAN := FALSE; ")
OTEXT(" v_dequeue BOOLEAN := FALSE; ")
OTEXT("BEGIN ")
OTEXT(" IF (:enqueue = 1) then ")
OTEXT(" v_enqueue := TRUE; ")
OTEXT(" END IF; ")
OTEXT(" IF (:dequeue = 1) then ")
OTEXT(" v_dequeue := TRUE; ")
OTEXT(" END IF; ")
OTEXT(" DBMS_AQADM.START_QUEUE ")
OTEXT(" (")
OTEXT(" queue_name => :queue_name, ")
OTEXT(" enqueue => v_enqueue, ")
OTEXT(" dequeue => v_dequeue ")
OTEXT(" ); ")
OTEXT("END; ")
);
call_status = call_status && OCI_BindString(st, OTEXT(":queue_name"), (otext *) queue_name, 0);
call_status = call_status && OCI_BindInt(st, OTEXT(":enqueue"), &enqueue);
call_status = call_status && OCI_BindInt(st, OTEXT(":dequeue"), &dequeue);
call_status = call_status && OCI_Execute(st);
OCI_StatementFree(st);
}
call_retval = call_status;
OCI_LIB_CALL_EXIT()
}
示例9: OCI_LIB_CALL_ENTER
OCI_Dequeue * OCI_API OCI_DequeueCreate
(
OCI_TypeInfo *typinf,
const otext *name
)
{
OCI_Dequeue *dequeue = NULL;
OCI_LIB_CALL_ENTER(OCI_Dequeue*, dequeue)
OCI_CHECK_PTR(OCI_IPC_TYPE_INFO, typinf)
OCI_CHECK_PTR(OCI_IPC_STRING, name)
/* allocate dequeue structure */
dequeue = (OCI_Dequeue *)OCI_MemAlloc(OCI_IPC_DEQUEUE, sizeof(*dequeue), (size_t)1, TRUE);
if (dequeue)
{
dequeue->typinf = typinf;
dequeue->name = ostrdup(name);
/* allocate dequeue options descriptor */
call_status = OCI_SUCCESSFUL(OCI_DescriptorAlloc((dvoid *)dequeue->typinf->con->env,
(dvoid **) &dequeue->opth,
OCI_DTYPE_AQDEQ_OPTIONS,
(size_t) 0, (dvoid **) NULL));
/* create local message for OCI_DequeueGet() */
if (call_status)
{
dequeue->msg = OCI_MsgCreate(dequeue->typinf);
}
call_status = (NULL != dequeue->msg);
}
/* check for failure */
if (call_status)
{
call_retval = dequeue;
}
else if (dequeue)
{
OCI_DequeueFree(dequeue);
}
OCI_LIB_CALL_EXIT()
}
示例10: OCI_CHECK_INITIALIZED2
OCI_Enqueue * OCI_API OCI_EnqueueCreate
(
OCI_Library *pOCILib,
OCI_TypeInfo *typinf,
const mtext *name
)
{
OCI_Enqueue *enqueue = NULL;
boolean res = TRUE;
OCI_CHECK_INITIALIZED2(pOCILib, NULL);
OCI_CHECK_PTR(pOCILib, OCI_IPC_TYPE_INFO, typinf, NULL);
OCI_CHECK_PTR(pOCILib, OCI_IPC_STRING, name, NULL);
/* allocate enqueue structure */
enqueue = (OCI_Enqueue *) OCI_MemAlloc2(pOCILib, OCI_IPC_ENQUEUE, sizeof(*enqueue), (size_t) 1, TRUE);
if (enqueue != NULL)
{
//printd(5, "OCI_EnqueueCreate() NAME> %s\n", name);
enqueue->typinf = typinf;
enqueue->name = mtsdup(pOCILib, name);
//printd(5, "OCI_EnqueueCreate() NAME2> %s; %p\n", enqueue->name, enqueue->typinf);
/* allocate enqueue options descriptor */
res = (OCI_SUCCESS == OCI_DescriptorAlloc2(pOCILib, (dvoid * ) pOCILib->env,
(dvoid **) &enqueue->opth,
OCI_DTYPE_AQENQ_OPTIONS,
(size_t) 0, (dvoid **) NULL));
//printd(5, "OCI_EnqueueCreate() RES=%d (%d)\n", res, FALSE);
}
else
{
res = FALSE;
}
/* check for failure */
if (res == FALSE)
{
OCI_EnqueueFree(pOCILib, enqueue);
enqueue = NULL;
}
return enqueue;
}