Class: Informix::CursorBase
- Inherits:
-
Object
- Object
- Informix::CursorBase
- Defined in:
- ext/informixc.c
Direct Known Subclasses
Instance Method Summary collapse
-
#close ⇒ Object
cursor.close => cursor.
-
#free ⇒ Object
cursor.free => nil.
-
#id ⇒ Object
cursor.id => string.
-
#open(*args) ⇒ Object
cursor.open(*params) => cursor.
Instance Method Details
#close ⇒ Object
cursor.close => cursor
Closes the cursor and returns __self__.
4079 4080 4081 4082 4083 4084 4085 4086 4087 |
# File 'ext/informixc.c', line 4079
static VALUE
rb_cursorbase_close(VALUE self)
{
cursor_t *c;
Data_Get_Struct(self, cursor_t, c);
cursorbase_close_or_free(c, 1);
return self;
}
|
#free ⇒ Object
cursor.free => nil
Closes the cursor and frees the memory associated with it. The cursor cannot be opened again.
4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 |
# File 'ext/informixc.c', line 4096
static VALUE
rb_cursorbase_free(VALUE self)
{
cursor_t *c;
Data_Get_Struct(self, cursor_t, c);
cursorbase_close_or_free(c, 2);
return Qnil;
}
|
#id ⇒ Object
cursor.id => string
Returns the cursor ID
3969 3970 3971 3972 3973 3974 3975 3976 |
# File 'ext/informixc.c', line 3969
static VALUE
rb_cursorbase_id(VALUE self)
{
cursor_t *c;
Data_Get_Struct(self, cursor_t, c);
return rb_str_new2(c->cursor_id);
}
|
#open(*args) ⇒ Object
cursor.open(*params) => cursor
Executes the previously prepared select statement, binding params as input parameters.
Returns __self__.
3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 |
# File 'ext/informixc.c', line 3987
static VALUE
rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
{
struct sqlda *input;
cursor_t *c;
/*
* EXEC SQL begin declare section;
*/
#line 3006 "informixc.ec"
#line 3007 "informixc.ec"
char *cid, *did;
/*
* EXEC SQL end declare section;
*/
#line 3008 "informixc.ec"
Data_Get_Struct(self, cursor_t, c);
if (c->is_open)
return self;
did = c->database_id;
/*
* EXEC SQL set connection :did;
*/
#line 3016 "informixc.ec"
{
#line 3016 "informixc.ec"
sqli_connect_set(0, did, 0);
#line 3016 "informixc.ec"
}
if (SQLCODE < 0)
raise_ifx_extended();
input = &c->daInput;
cid = c->cursor_id;
if (c->is_select) {
if (argc != input->sqld) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, input->sqld);
}
if (argc) {
bind_input_params(c, argv);
/*
* EXEC SQL open :cid using descriptor input
* with reoptimization;
*/
#line 3030 "informixc.ec"
{
#line 3031 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0, (struct value *)0, 1, 1);
#line 3031 "informixc.ec"
}
clean_input_slots(c);
}
else
/*
* EXEC SQL open :cid with reoptimization;
*/
#line 3035 "informixc.ec"
{
#line 3035 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 1);
#line 3035 "informixc.ec"
}
}
else
/*
* EXEC SQL open :cid;
*/
#line 3038 "informixc.ec"
{
#line 3038 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
#line 3038 "informixc.ec"
}
if (SQLCODE < 0)
raise_ifx_extended();
c->is_open = 1;
return self;
}
|