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__.
4072 4073 4074 4075 4076 4077 4078 4079 4080 |
# File 'ext/informixc.c', line 4072
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.
4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 |
# File 'ext/informixc.c', line 4089
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
3962 3963 3964 3965 3966 3967 3968 3969 |
# File 'ext/informixc.c', line 3962
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__.
3980 3981 3982 3983 3984 3985 3986 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 |
# File 'ext/informixc.c', line 3980
static VALUE
rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
{
struct sqlda *input;
cursor_t *c;
/*
* EXEC SQL begin declare section;
*/
#line 2999 "informixc.ec"
#line 3000 "informixc.ec"
char *cid, *did;
/*
* EXEC SQL end declare section;
*/
#line 3001 "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 3009 "informixc.ec"
{
#line 3009 "informixc.ec"
sqli_connect_set(0, did, 0);
#line 3009 "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 3023 "informixc.ec"
{
#line 3024 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0, (struct value *)0, 1, 1);
#line 3024 "informixc.ec"
}
clean_input_slots(c);
}
else
/*
* EXEC SQL open :cid with reoptimization;
*/
#line 3028 "informixc.ec"
{
#line 3028 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 1);
#line 3028 "informixc.ec"
}
}
else
/*
* EXEC SQL open :cid;
*/
#line 3031 "informixc.ec"
{
#line 3031 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
#line 3031 "informixc.ec"
}
if (SQLCODE < 0)
raise_ifx_extended();
c->is_open = 1;
return self;
}
|