Sneak in optional timeout argument as a stub to the C version of Mysql.send_query

This commit is contained in:
Lourens Naude 2008-09-05 23:55:00 +01:00
parent 58d416e929
commit 19b4b10d27

View File

@ -756,10 +756,14 @@ static VALUE socket(VALUE obj)
return INT2NUM(vio_fd(m->net.vio));
}
/* send_query */
static VALUE send_query(VALUE obj, VALUE sql)
/* send_query(sql,timeout=nil) */
static VALUE send_query(int argc, VALUE* argv, VALUE obj)
{
MYSQL* m = GetHandler(obj);
VALUE sql, timeout;
rb_scan_args(argc, argv, "11", &sql, &timeout);
Check_Type(sql, T_STRING);
if (GetMysqlStruct(obj)->connection == Qfalse) {
rb_raise(eMysql, "query: not connected");
@ -2086,7 +2090,7 @@ void Init_mysql(void)
rb_define_method(cMysql, "query", query, 1);
rb_define_method(cMysql, "real_query", query, 1);
/*rb_define_method(cMysql, "async_query", async_query, 1);*/
rb_define_method(cMysql, "send_query", send_query, 1);
rb_define_method(cMysql, "send_query", send_query, -1);
rb_define_method(cMysql, "get_result", get_result, 0);
rb_define_method(cMysql, "socket", socket, 0);
rb_define_method(cMysql, "refresh", refresh, 1);