Method: ActiveSQL::Base.exec_sql
- Defined in:
- ext/activesql.c
.exec_sql(arg) ⇒ Object
return RARRAY(self)->ptr;
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'ext/activesql.c', line 103
static VALUE activeSQL_exec_sql(VALUE self, VALUE arg) {
VALUE f;
if (mysObj.reconnect == 1)
f = rb_funcall(rb_cBase, rb_intern("connect!"), 0);
else
f = Qtrue;
if (TYPE(f) == T_TRUE) {
if (TYPE(arg) != T_STRING)
rb_raise(rb_eTypeError, "invalid type for input");
if (mysql_real_query(mysObj.conn, RSTRING_PTR(arg), (unsigned int) strlen(RSTRING_PTR(arg))))
rb_raise(rb_eSqlError, mysql_error(mysObj.conn));
else
return Qtrue;
}
else
rb_raise(rb_eSqlError, "Connection not established.");
}
|