Пример #1
0
boolean OCI_SubscriptionClose
(
    OCI_Subscription *sub
)
{
    boolean res = TRUE;

    OCI_CHECK_PTR(OCI_IPC_NOTIFY, sub, FALSE);

#if OCI_VERSION_COMPILE >= OCI_10_2

    /* deregister the subscription if connection still alive */

    if (sub->subhp != NULL)
    {
        OCI_Connection * con = NULL;

        if (sub->con == NULL)
        {
            con = OCI_ConnectionCreate(sub->saved_db, sub->saved_user,
                                       sub->saved_pwd, OCI_SESSION_DEFAULT);

            sub->con = con;
        }

        if (sub->con != NULL)
        {
            OCI_CALL3
            (
                res, sub->err,

                OCISubscriptionUnRegister(sub->con->cxt, sub->subhp,
                                          sub->err,(ub4) OCI_DEFAULT)
            )
        }

        if (con != NULL)
        {
            OCI_ConnectionFree(con);
        }
    }
Пример #2
0
OCI_EXPORT boolean OCI_API OCI_DequeueUnsubscribe
(
    OCI_Dequeue *dequeue
)
{
    boolean res = TRUE;
 
    OCI_CHECK_DATABASE_NOTIFY_ENABLED(FALSE);

    OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, FALSE);

    dequeue->callback = NULL;
    
    if (dequeue->subhp != NULL)
    {
        /* unregister the subscription */

        OCI_CALL3
        (
            res, dequeue->typinf->con->err,

            OCISubscriptionUnRegister(dequeue->typinf->con->cxt, dequeue->subhp,
                                      dequeue->typinf->con->err,(ub4) OCI_DEFAULT)
        )

        /* free OCI handle */

        OCI_HandleFree((dvoid *) dequeue->subhp, OCI_HTYPE_SUBSCRIPTION);

        dequeue->subhp = NULL;
    }

    OCI_RESULT(res);

    return res;
}