Exemplo n.º 1
0
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()
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
boolean OCI_API OCI_DateNextDay
(
    OCI_Date    *date,
    const otext *day
)
{
    dbtext *dbstr  = NULL;
    int     dbsize = -1;

    OCI_LIB_CALL_ENTER(boolean, FALSE)

    OCI_CHECK_PTR(OCI_IPC_DATE, date)
    OCI_CHECK_PTR(OCI_IPC_STRING, day)

    dbstr = OCI_StringGetOracleString(day, &dbsize);

    call_status = TRUE;

    OCI_CALL4
    (
        call_status, date->err, date->con,

        OCIDateNextDay(date->err, date->handle, (oratext *) dbstr, (ub4) dbsize, date->handle)
    )

    OCI_StringReleaseOracleString(dbstr);

    call_retval = call_status;

    OCI_LIB_CALL_EXIT()
}
Exemplo n.º 4
0
int OCI_API OCI_DateDaysBetween
(
    OCI_Date *date,
    OCI_Date *date2
)
{
    sb4 diff = 0;

    OCI_LIB_CALL_ENTER(int, diff)

    OCI_CHECK_PTR(OCI_IPC_DATE, date);
    OCI_CHECK_PTR(OCI_IPC_DATE, date2);

    call_status = TRUE;

    OCI_CALL4
    (
        call_status, date->err, date->con,

        OCIDateDaysBetween(date->err, date->handle, date2->handle, &diff)
    )

    call_retval = (int) diff;

    OCI_LIB_CALL_EXIT()
}
Exemplo n.º 5
0
boolean OCI_API OCI_DateGetDate
(
    OCI_Date *date,
    int      *year,
    int      *month,
    int      *day
)
{
    sb2 yr = 0;
    ub1 mt = 0;
    ub1 dy = 0;

    OCI_LIB_CALL_ENTER(boolean, FALSE)

    OCI_CHECK_PTR(OCI_IPC_DATE, date)
    OCI_CHECK_PTR(OCI_IPC_INT, year)
    OCI_CHECK_PTR(OCI_IPC_INT, month)
    OCI_CHECK_PTR(OCI_IPC_INT, day)

    OCIDateGetDate(date->handle, &yr, &mt, &dy);

    *year  = (int) yr;
    *month = (int) mt;
    *day   = (int) dy;

    call_retval = call_status = TRUE;

    OCI_LIB_CALL_EXIT()
}
Exemplo n.º 6
0
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()
}
Exemplo n.º 7
0
/* ------------------------------------------------------------------------ *
 * 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;
}
Exemplo n.º 8
0
boolean OCI_API OCI_MsgGetID
(
    OCI_Msg      *msg,
    void         *id,
    unsigned int *len
)
{
    boolean res   = TRUE;

    OCI_CHECK_PTR(OCI_IPC_MSG,  msg, FALSE);
    OCI_CHECK_PTR(OCI_IPC_VOID, id,  FALSE);
    OCI_CHECK_PTR(OCI_IPC_VOID, len, FALSE);

    if (msg->id != NULL)
    {
        ub4 raw_len = 0;

        raw_len = OCIRawSize(msg->typinf->con->env, msg->id);

        if (*len > raw_len)
        {
            *len = raw_len;
        }

        memcpy(id, OCIRawPtr(msg->typinf->con->env, msg->id), (size_t) (*len));
    }
    else
    {
        *len = 0;
    }

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
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;
}
Exemplo n.º 11
0
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()
}
Exemplo n.º 12
0
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()
}
Exemplo n.º 13
0
OCI_Dequeue * OCI_API OCI_DequeueCreate
(
    OCI_TypeInfo *typinf,
    const mtext  *name
)
{
    OCI_Dequeue *dequeue = NULL;
    boolean res          = TRUE;

    OCI_CHECK_INITIALIZED(NULL);

    OCI_CHECK_PTR(OCI_IPC_TYPE_INFO, typinf, NULL);
    OCI_CHECK_PTR(OCI_IPC_STRING, name, NULL);

    /* allocate dequeue structure */

    dequeue = (OCI_Dequeue *) OCI_MemAlloc(OCI_IPC_DEQUEUE, sizeof(*dequeue), (size_t) 1, TRUE);

    if (dequeue != NULL)
    {
        dequeue->typinf = typinf;
        dequeue->name   = mtsdup(name);

        /* allocate dequeue options descriptor */

        res = (OCI_SUCCESS == 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 (res == TRUE)
        {
            dequeue->msg = OCI_MsgCreate(dequeue->typinf);
        }

        res = (dequeue->msg != NULL);
    }
    else
    {
        res = FALSE;
    }

    /* check for failure */

    if (res == FALSE)
    {
        OCI_DequeueFree(dequeue);
        dequeue = NULL;
    }

    return dequeue;
}
Exemplo n.º 14
0
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()
}
Exemplo n.º 15
0
boolean OCI_API OCI_QueueAlter
(
    OCI_Connection *con,
    const otext    *queue_name,
    unsigned int    max_retries,
    unsigned int    retry_delay,
    unsigned int    retention_time,
    const otext    *comment
)
{
    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("BEGIN ")
                        OTEXT("    DBMS_AQADM.ALTER_QUEUE ")
                        OTEXT("    (")
                        OTEXT("        queue_name           => :queue_name, ")
                        OTEXT("        max_retries          => :max_retries, ")
                        OTEXT("        retry_delay          => :retry_delay, ")
                        OTEXT("        retention_time       => :retention_time, ")
                        OTEXT("        comment              => :comment ")
                        OTEXT("    ); ")
                        OTEXT("END; ")
                    );

        call_status = call_status && OCI_BindString(st, OTEXT(":queue_name"),  (otext *) queue_name, 0);
        call_status = call_status && OCI_BindUnsignedInt(st, OTEXT(":max_retries"),  &max_retries);
        call_status = call_status && OCI_BindUnsignedInt(st, OTEXT(":retry_delay"),  &retry_delay);
        call_status = call_status && OCI_BindUnsignedInt(st, OTEXT(":retention_time"),  &retention_time);
        call_status = call_status && OCI_BindString(st, OTEXT(":comment"), (otext *) (comment ? comment : OCI_STRING_EMPTY), 0);

        call_status = call_status && OCI_Execute(st);

        OCI_StatementFree(st);
    }

    call_retval = call_status;

    OCI_LIB_CALL_EXIT()
}
Exemplo n.º 16
0
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;
}
Exemplo n.º 17
0
boolean OCI_API OCI_QueueTableAlter
(
    OCI_Connection *con,
    const otext    *queue_table,
    const otext    *comment,
    unsigned int    primary_instance,
    unsigned int    secondary_instance
)
{
    OCI_Statement *st = NULL;

    OCI_LIB_CALL_ENTER(boolean, FALSE)

    OCI_CHECK_PTR(OCI_IPC_CONNECTION, con)
    OCI_CHECK_PTR(OCI_IPC_STRING, queue_table)

    st = OCI_StatementCreate(con);

    if (st)
    {
        call_status = OCI_Prepare
                      (
                            st,
                            OTEXT("BEGIN ")
                            OTEXT("    DBMS_AQADM.ALTER_QUEUE_TABLE ")
                            OTEXT("   (")
                            OTEXT("       queue_table        => :queue_table, ")
                            OTEXT("       comment            => :comment, ")
                            OTEXT("       primary_instance   => :primary_instance, ")
                            OTEXT("       secondary_instance => :secondary_instance ")
                            OTEXT("   ); ")
                            OTEXT("END; ")
                      );

        call_status = call_status && OCI_BindString(st, OTEXT(":queue_table"), (otext *)  queue_table, 0);
        call_status = call_status && OCI_BindString(st, OTEXT(":comment"),  (otext *) (comment ?  comment: OCI_STRING_EMPTY), 0);
        call_status = call_status && OCI_BindUnsignedInt(st, OTEXT(":primary_instance"),  &primary_instance);
        call_status = call_status && OCI_BindUnsignedInt(st, OTEXT(":secondary_instance"),  &secondary_instance);

        call_status = call_status && OCI_Execute(st);

        OCI_StatementFree(st);
    }

    call_retval = call_status;

    OCI_LIB_CALL_EXIT()
}
Exemplo n.º 18
0
boolean OCI_API OCI_MsgGetOriginalID
(
    OCI_Msg      *msg,
    void         *id,
    unsigned int *len
)
{
    boolean res   = TRUE;
    OCIRaw *value = NULL;

    OCI_CHECK_PTR(OCI_IPC_MSG,  msg, FALSE);
    OCI_CHECK_PTR(OCI_IPC_VOID, id,  FALSE);
    OCI_CHECK_PTR(OCI_IPC_VOID, len, FALSE);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrGet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) &value,
                   (ub4   *) NULL,
                   (ub4    ) OCI_ATTR_ORIGINAL_MSGID,
                   msg->typinf->con->err)
    )

    if (value != NULL)
    {
        ub4 raw_len = 0;

        raw_len = OCIRawSize(msg->typinf->con->env, value);

        if (*len > raw_len)
        {
            *len = raw_len;
        }

        memcpy(id, OCIRawPtr(msg->typinf->con->env, value), (size_t) (*len));
    }
    else
    {
        *len = 0;
    }

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 19
0
boolean OCI_API OCI_DequeueSetWaitTime
(
    OCI_Dequeue *dequeue,
    int          timeout
)
{
    boolean res = TRUE;
    sb4 value   = (ub4) timeout;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, FALSE);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrSet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &value,
                   (ub4    ) 0,
                   (ub4    )  OCI_ATTR_WAIT,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 20
0
int OCI_API OCI_DequeueGetWaitTime
(
    OCI_Dequeue *dequeue
)
{
    boolean res = TRUE;
    sb4 ret     = 0;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, 0);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrGet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &ret,
                   (ub4   *) NULL,
                   (ub4    )  OCI_ATTR_WAIT,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return (int) ret;
}
Exemplo n.º 21
0
boolean OCI_API OCI_DequeueSetNavigation
(
    OCI_Dequeue *dequeue,
    unsigned int position
)
{
    boolean res = TRUE;
    ub4 value   = (ub4) position;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, FALSE);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrSet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &value,
                   (ub4    ) 0,
                   (ub4    ) OCI_ATTR_NAVIGATION,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 22
0
unsigned int OCI_API OCI_DequeueGetNavigation
(
    OCI_Dequeue *dequeue
)
{
    boolean res = TRUE;
    ub4 ret     = 0;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, 0);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrGet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &ret,
                   (ub4   *) NULL,
                   (ub4    ) OCI_ATTR_NAVIGATION,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return (int) ret;
}
Exemplo n.º 23
0
boolean OCI_API OCI_DequeueSetMode
(
    OCI_Dequeue *dequeue,
    unsigned int mode
)
{
    boolean res = TRUE;
    ub4 value   = (ub4) mode;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, FALSE);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrSet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &value,
                   (ub4    ) 0,
                   (ub4    ) OCI_ATTR_DEQ_MODE,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 24
0
boolean OCI_API OCI_DequeueSetVisibility
(
    OCI_Dequeue *dequeue,
    unsigned int visibility
)
{
    boolean res = TRUE;
    ub4 value   = (ub4) visibility;

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, FALSE);

    OCI_CALL2
    (
        res, dequeue->typinf->con,

        OCIAttrSet((dvoid *) dequeue->opth,
                   (ub4    ) OCI_DTYPE_AQDEQ_OPTIONS,
                   (dvoid *) &value,
                   (ub4    ) 0,
                   (ub4    ) OCI_ATTR_VISIBILITY,
                   dequeue->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 25
0
boolean OCI_API OCI_MsgSetRaw
(
    OCI_Msg      *msg,
    const void   *raw,
    unsigned int  size
)
{
    boolean res = TRUE;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE);

    OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode == OCI_UNKNOWN, FALSE);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIRawAssignBytes(msg->typinf->con->env, msg->typinf->con->err,
                          (ub1*) raw, (ub4) size, (OCIRaw **) &msg->payload)
    )

    if ((res == TRUE) && (msg->payload != NULL) && (size > 0))
    {
        msg->ind = OCI_IND_NOTNULL;
    }
    else
    {
        msg->ind = OCI_IND_NULL;
    }

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 26
0
OCI_Date * OCI_API OCI_MsgGetEnqueueTime
(
    OCI_Msg *msg
)
{
    boolean res    = TRUE;
    OCI_Date *date = NULL;
    OCIDate oci_date;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, NULL);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrGet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) &oci_date,
                   (ub4   *) NULL,
                   (ub4    ) OCI_ATTR_ENQ_TIME,
                   msg->typinf->con->err)
    )

    if (res == TRUE)
    {
        date = OCI_DateInit(msg->typinf->con, &msg->date, &oci_date, FALSE, FALSE);

        res = (date != NULL);
    }

    OCI_RESULT(res);

    return date;
}
Exemplo n.º 27
0
boolean OCI_API OCI_MsgSetSender
(
    OCI_Msg   *msg,
    OCI_Agent *sender
)
{
    boolean res = TRUE;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrSet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) (sender ? sender->handle : NULL),
                   (ub4    ) 0,
                   (ub4    ) OCI_ATTR_SENDER_ID,
                   msg->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}
Exemplo n.º 28
0
OCI_Agent * OCI_API OCI_MsgGetSender
(
    OCI_Msg   *msg
)
{
    boolean res = TRUE;
    OCIAQAgent *handle = NULL;
    OCI_Agent  *sender = NULL;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, NULL);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrGet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) &handle,
                   (ub4    ) 0,
                   (ub4    ) OCI_ATTR_SENDER_ID,
                   msg->typinf->con->err)
    )

    if ((res == TRUE) && (handle != NULL))
    {
        sender = OCI_AgentInit(msg->typinf->con, &msg->sender, handle, NULL, NULL);
    }

    OCI_RESULT(res);

    return sender;
}
Exemplo n.º 29
0
int OCI_API OCI_MsgGetPriority
(
    OCI_Msg *msg
)
{
    boolean res = TRUE;
    sb4 ret     = 0;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, 0);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrGet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) &ret,
                   (ub4   *) NULL,
                   (ub4    ) OCI_ATTR_PRIORITY,
                   msg->typinf->con->err)
    )

    OCI_RESULT(res);

    return (int) ret;
}
Exemplo n.º 30
0
boolean OCI_API OCI_MsgSetPriority
(
    OCI_Msg *msg,
    int      value
)
{
    boolean res = TRUE;
    sb4 sval    = (sb4) value;

    OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE);

    OCI_CALL2
    (
        res, msg->typinf->con,

        OCIAttrSet((dvoid *) msg->proph,
                   (ub4    ) OCI_DTYPE_AQMSG_PROPERTIES,
                   (dvoid *) &sval,
                   (ub4    ) sizeof(sval),
                   (ub4    ) OCI_ATTR_PRIORITY,
                   msg->typinf->con->err)
    )

    OCI_RESULT(res);

    return res;
}