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__.
4085 4086 4087 4088 4089 4090 4091 4092 4093 |
# File 'ext/informixc.c', line 4085
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.
4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 |
# File 'ext/informixc.c', line 4102
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
3975 3976 3977 3978 3979 3980 3981 3982 |
# File 'ext/informixc.c', line 3975
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__.
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 4072 4073 4074 4075 4076 4077 |
# File 'ext/informixc.c', line 3993
static VALUE
rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
{
struct sqlda *input;
cursor_t *c;
/*
* EXEC SQL begin declare section;
*/
#line 3012 "informixc.ec"
#line 3013 "informixc.ec"
char *cid, *did;
/*
* EXEC SQL end declare section;
*/
#line 3014 "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 3022 "informixc.ec"
{
#line 3022 "informixc.ec"
sqli_connect_set(0, did, 0);
#line 3022 "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 3036 "informixc.ec"
{
#line 3037 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0, (struct value *)0, 1, 1);
#line 3037 "informixc.ec"
}
clean_input_slots(c);
}
else
/*
* EXEC SQL open :cid with reoptimization;
*/
#line 3041 "informixc.ec"
{
#line 3041 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 1);
#line 3041 "informixc.ec"
}
}
else
/*
* EXEC SQL open :cid;
*/
#line 3044 "informixc.ec"
{
#line 3044 "informixc.ec"
sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
#line 3044 "informixc.ec"
}
if (SQLCODE < 0)
raise_ifx_extended();
c->is_open = 1;
return self;
}
|