diff options
author | unknown <pem@mysql.com> | 2004-03-25 17:48:00 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2004-03-25 17:48:00 +0100 |
commit | d31bb74adeddabad3d708faf4cc264493a623416 (patch) | |
tree | 0795028fc3c1987590aa4d86fbb5e55b6a4278b2 /tests | |
parent | bdb874226efb55979eb8eef909f050ba6f949ab8 (diff) | |
parent | df06466976e3d9e63ed8f95e5543578b7ec572ac (diff) | |
download | mariadb-git-d31bb74adeddabad3d708faf4cc264493a623416.tar.gz |
Merge fix.
sql/sql_yacc.yy:
Auto merged
tests/client_test.c:
Merge fix (two new test cases at the same time).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 5aa48255a64..b50c9d58dc6 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -8432,6 +8432,68 @@ static void test_union() myquery(rc); } +static void test_bug3117() +{ + MYSQL_STMT *stmt; + MYSQL_BIND buffer; + longlong lii; + ulong length; + my_bool is_null; + int rc; + + myheader("test_bug3117"); + + rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql,"CREATE TABLE t1 (id int auto_increment primary key)"); + myquery(rc); + + stmt = mysql_simple_prepare(mysql, "SELECT LAST_INSERT_ID()"); + mystmt_init(stmt); + + rc= mysql_query(mysql, "INSERT INTO t1 VALUES (NULL)"); + myquery(rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + buffer.buffer_type= MYSQL_TYPE_LONGLONG; + buffer.buffer_length= sizeof(lii); + buffer.buffer= (char *)&lii; + buffer.length= &length; + buffer.is_null= &is_null; + + rc= mysql_bind_result(stmt, &buffer); + mystmt(stmt,rc); + + rc= mysql_stmt_store_result(stmt); + mystmt(stmt,rc); + + rc = mysql_fetch(stmt); + mystmt(stmt, rc); + + assert(is_null == 0 && lii == 1); + fprintf(stdout, "\n\tLAST_INSERT_ID() = 1 ok\n"); + + rc= mysql_query(mysql, "INSERT INTO t1 VALUES (NULL)"); + myquery(rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + rc = mysql_fetch(stmt); + mystmt(stmt, rc); + + assert(is_null == 0 && lii == 2); + fprintf(stdout, "\tLAST_INSERT_ID() = 2 ok\n"); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE t1"); + myquery(rc); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -8690,6 +8752,7 @@ int main(int argc, char **argv) test_subqueries_ref(); /* outer reference in subqueries converted Item_field -> Item_ref */ test_union(); /* test union with prepared statements */ + test_bug3117(); /* BUG#3117: LAST_INSERT_ID() */ end_time= time((time_t *)0); total_time+= difftime(end_time, start_time); |