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.
-
#drop ⇒ Object
cursor.drop => 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__.
4077 4078 4079 4080 4081 4082 4083 4084 4085 |
# File 'ext/informixc.c', line 4077
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;
}
|
#drop ⇒ Object
cursor.drop => nil
Closes the cursor and frees the memory associated with it. The cursor cannot be opened again.
4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 |
# File 'ext/informixc.c', line 4094
static VALUE
rb_cursorbase_drop(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
3967 3968 3969 3970 3971 3972 3973 3974 |
# File 'ext/informixc.c', line 3967
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__.
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 4065 4066 4067 4068 4069 |
# File 'ext/informixc.c', line 3985
static VALUE
rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
{
struct sqlda *input;
cursor_t *c;
/*
* EXEC SQL begin declare section;
*/
#line 2988 "informixc.ec"
#line 2989 "informixc.ec"
char *cid, *did;
/*
* EXEC SQL end declare section;
*/
#line 2990 "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 2998 "informixc.ec"
{
#line 2998 "informixc.ec"
sqli_connect_set(0, did, 0);
#line 2998 "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 3012 "informixc.ec"
{
#line 3013 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0, (struct value *)0, 1, 1);
#line 3013 "informixc.ec"
}
clean_input_slots(c);
}
else
/*
* EXEC SQL open :cid with reoptimization;
*/
#line 3017 "informixc.ec"
{
#line 3017 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 1);
#line 3017 "informixc.ec"
}
}
else
/*
* EXEC SQL open :cid;
*/
#line 3020 "informixc.ec"
{
#line 3020 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
#line 3020 "informixc.ec"
}
if (SQLCODE < 0)
raise_ifx_extended();
c->is_open = 1;
return self;
}
|