on second thought, we should make sure we were given a string earlier on

This commit is contained in:
Brian Lopez 2010-07-10 10:32:46 -07:00
parent 645b9a1bef
commit d8f5f4de1d
1 changed files with 6 additions and 3 deletions

View File

@ -221,6 +221,7 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
} }
} }
Check_Type(args.sql, T_STRING);
#ifdef HAVE_RUBY_ENCODING_H #ifdef HAVE_RUBY_ENCODING_H
rb_encoding *conn_enc = rb_to_encoding(rb_iv_get(self, "@encoding")); rb_encoding *conn_enc = rb_to_encoding(rb_iv_get(self, "@encoding"));
// ensure the string is in the encoding the connection is expecting // ensure the string is in the encoding the connection is expecting
@ -265,6 +266,8 @@ static VALUE rb_mysql_client_escape(VALUE self, VALUE str) {
MYSQL * client; MYSQL * client;
VALUE newStr; VALUE newStr;
unsigned long newLen, oldLen; unsigned long newLen, oldLen;
Check_Type(str, T_STRING);
#ifdef HAVE_RUBY_ENCODING_H #ifdef HAVE_RUBY_ENCODING_H
rb_encoding *default_internal_enc = rb_default_internal_encoding(); rb_encoding *default_internal_enc = rb_default_internal_encoding();
rb_encoding *conn_enc = rb_to_encoding(rb_iv_get(self, "@encoding")); rb_encoding *conn_enc = rb_to_encoding(rb_iv_get(self, "@encoding"));