Class: ODPI::Dpi::ObjectType

Inherits:
Object
  • Object
show all
Defined in:
ext/odpi_ext/rbdpi-object-type.c

Instance Method Summary collapse

Constructor Details

#initializeObject


41
42
43
44
45
# File 'ext/odpi_ext/rbdpi.c', line 41

VALUE rbdpi_initialize_error(VALUE self)
{
    rb_raise(rb_eRuntimeError, "could not initialize by %s::new", rb_obj_classname(self));
    return Qnil;
}

Instance Method Details

#attributesObject


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'ext/odpi_ext/rbdpi-object-type.c', line 115

static VALUE object_type_get_attributes(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);
    uint16_t idx, num_attrs;
    dpiObjectAttr **attrs;
    VALUE ary;

    num_attrs = objtype->info.numAttributes;

    if (num_attrs == 0) {
        return rb_ary_new();
    }
    attrs = ALLOCA_N(dpiObjectAttr *, num_attrs);
    CHK(dpiObjectType_getAttributes(objtype->handle, num_attrs, attrs));

    ary = rb_ary_new_capa(num_attrs);
    for (idx = 0; idx < num_attrs; idx++) {
        rb_ary_push(ary, rbdpi_from_object_attr(attrs[idx], &objtype->enc));
    }
    return ary;
}

#create_objectObject


71
72
73
74
75
76
77
78
# File 'ext/odpi_ext/rbdpi-object-type.c', line 71

static VALUE object_type_create_object(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);
    dpiObject *object;

    CHK(dpiObjectType_createObject(objtype->handle, &object));
    return rbdpi_from_object(object, self);
}

#element_type_infoObject


101
102
103
104
105
106
# File 'ext/odpi_ext/rbdpi-object-type.c', line 101

static VALUE object_type_get_element_type_info(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);

    return objtype->elem_datatype;
}

#initialize_copy(other) ⇒ Object


65
66
67
68
69
# File 'ext/odpi_ext/rbdpi-object-type.c', line 65

static VALUE object_type_initialize_copy(VALUE self, VALUE other)
{
    *rbdpi_to_object_type(self) = *rbdpi_to_object_type(other);
    return self;
}

#is_collection?Boolean

Returns:

  • (Boolean)

94
95
96
97
98
99
# File 'ext/odpi_ext/rbdpi-object-type.c', line 94

static VALUE object_type_is_collection_p(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);

    return objtype->info.isCollection ? Qtrue : Qfalse;
}

#nameObject


87
88
89
90
91
92
# File 'ext/odpi_ext/rbdpi-object-type.c', line 87

static VALUE object_type_get_name(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);

    return rb_external_str_new_with_enc(objtype->info.name, objtype->info.nameLength, objtype->enc.enc);
}

#num_attributesObject


108
109
110
111
112
113
# File 'ext/odpi_ext/rbdpi-object-type.c', line 108

static VALUE object_type_get_num_attributes(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);

    return INT2FIX(objtype->info.numAttributes);
}

#schemaObject


80
81
82
83
84
85
# File 'ext/odpi_ext/rbdpi-object-type.c', line 80

static VALUE object_type_get_schema(VALUE self)
{
    object_type_t *objtype = rbdpi_to_object_type(self);

    return rb_external_str_new_with_enc(objtype->info.schema, objtype->info.schemaLength, objtype->enc.enc);
}