Пример #1
0
void oci8_link_to_parent(oci8_base_t *base, oci8_base_t *parent)
{
    if (base->parent != NULL) {
        oci8_unlink_from_parent(base);
    }
    if (parent->children == NULL) {
        parent->children = base;
    } else {
        base->next = parent->children;
        base->prev = parent->children->prev;
        parent->children->prev->next = base;
        parent->children->prev = base;
    }
    base->parent = parent;
}
Пример #2
0
void oci8_base_free(oci8_base_t *base)
{
    while (base->children != NULL) {
        oci8_base_free(base->children);
    }
    oci8_unlink_from_parent(base);
    if (base->vptr->free != NULL)
        base->vptr->free(base);
    if (base->type >= OCI_DTYPE_FIRST) {
        OCIDescriptorFree(base->hp.ptr, base->type);
    } else if (base->type == OCI_HTYPE_BIND || base->type == OCI_HTYPE_DEFINE) {
        ; /* Do nothing. Bind handles and define handles are freed when
           * associating statement handles are freed.
           */
    } else if (base->type >= OCI_HTYPE_FIRST) {
        OCIHandleFree(base->hp.ptr, base->type);
    }
    base->type = 0;
    base->hp.ptr = NULL;
}
Пример #3
0
void oci8_link_to_parent(oci8_base_t *base, oci8_base_t *parent)
{
    VALUE old_parent = Qundef;

    if (base->parent != NULL) {
        old_parent = base->parent->self;
        oci8_unlink_from_parent(base);
    }
    if (parent->children == NULL) {
        parent->children = base;
    } else {
        base->next = parent->children;
        base->prev = parent->children->prev;
        parent->children->prev->next = base;
        parent->children->prev = base;
    }
    base->parent = parent;
    RB_OBJ_WRITTEN(parent->self, Qundef, base->self);
    RB_OBJ_WRITTEN(base->self, old_parent, parent->self);
}