diff options
author | unknown <sergefp@mysql.com> | 2004-04-30 16:28:04 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-04-30 16:28:04 +0400 |
commit | 2b84899fb35e1445077597200ce0f0b1a614a1b0 (patch) | |
tree | d208abd5b4dbfe394b32cf26b1bf1e2f7a294837 /tests | |
parent | b8dc907ad1254920484236b5d597fa0a1b663896 (diff) | |
parent | 6a5d27031a037eca3dd766a467ff149460db5fd2 (diff) | |
download | mariadb-git-2b84899fb35e1445077597200ce0f0b1a614a1b0.tar.gz |
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-bug3420
tests/client_test.c:
Auto merged
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 8aaa9983bc9..3e260899bf6 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -1829,6 +1829,63 @@ static void test_select() } /* + Test for BUG#3420 ("select id1,value1 from t where id=? or value=?" + returns all rows in the table) +*/ +static void test_ps_conj_select() +{ + MYSQL_STMT *stmt; + int rc; + MYSQL_BIND bind[2]; + long int int_data; + char str_data[32]; + unsigned long str_length; + myheader("test_ps_conj_select"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + + rc= mysql_query(mysql, "create table t1 (id1 int(11) NOT NULL default '0'," + "value2 varchar(100), value1 varchar(100))"); + myquery(rc); + + rc= mysql_query(mysql, "insert into t1 values (1,'hh','hh'),(2,'hh','hh')," + "(1,'ii','ii'),(2,'ii','ii')"); + myquery(rc); + + strmov(query, "select id1,value1 from t1 where id1=? or value1=?"); + stmt= mysql_simple_prepare(mysql, query); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&int_data; + bind[0].is_null= 0; + bind[0].length= 0; + + bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; + bind[1].buffer= (char *)str_data; + bind[1].buffer_length= array_elements(str_data); + bind[1].is_null= 0; + bind[1].length= &str_length; + + rc = mysql_bind_param(stmt,bind); + mystmt(stmt, rc); + + int_data= 1; + strcpy(str_data, "hh"); + str_length= strlen(str_data); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + assert(my_process_stmt_result(stmt) == 3); + + mysql_stmt_close(stmt); +} + +/* test BUG#1115 (incorrect string parameter value allocation) */ static void test_bug1115() @@ -9508,6 +9565,7 @@ int main(int argc, char **argv) test_select_prepare(); /* prepare select - protocol_prep debug */ test_select(); /* simple select test */ test_select_version(); /* select with variables */ + test_ps_conj_select(); /* prepare select with "where a=? or b=?" */ test_select_show_table();/* simple show prepare */ #if NOT_USED /* |