1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fixed test case for expired password

Added test case for ODBC-138
This commit is contained in:
Georg Richter
2018-04-20 07:19:40 +02:00
parent 60e5deec52
commit 3f43953fcb
2 changed files with 41 additions and 7 deletions

View File

@@ -1340,21 +1340,15 @@ static int test_expired_pw(MYSQL *my)
my_test_connect(mysql, hostname, "foo", "foo", schema,
port, socketname, 0);
rc= mysql_query(mysql, "CREATE TEMPORARY TABLE t1 (a int)");
diag("error: %d %s", mysql_errno(mysql), mysql_error(mysql));
FAIL_IF(mysql_errno(mysql) != ER_MUST_CHANGE_PASSWORD, "Error 1820 expected");
rc= mysql_query(mysql, "SET PASSWORD=PASSWORD('foobar')");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "CREATE TEMPORARY TABLE t1 (a int)");
check_mysql_rc(rc, mysql);
mysql_close(mysql);
sprintf(query, "DROP USER 'foo'@'%s'", this_host);
rc= mysql_query(my, query);
check_mysql_rc(rc, my);
mysql_close(mysql);
return OK;
}

View File

@@ -4651,8 +4651,48 @@ static int test_compress(MYSQL *mysql)
return OK;
}
static int test_codbc138(MYSQL *mysql)
{
int rc;
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
MYSQL_BIND bind[1];
MYSQL_TIME tm;
rc= mysql_stmt_prepare(stmt, SL("SELECT DATE_ADD('2018-02-01', INTERVAL -188 DAY)"));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
memset(bind, 0, sizeof(MYSQL_BIND));
bind[0].buffer_type= MYSQL_TYPE_DATETIME;
bind[0].buffer= &tm;
bind[0].buffer_length= sizeof(MYSQL_TIME);
rc= mysql_stmt_bind_result(stmt, bind);
check_stmt_rc(rc, stmt);
rc= mysql_stmt_fetch(stmt);
check_stmt_rc(rc, stmt);
if (tm.year != 2017 && tm.day != 28 && tm.month != 7)
{
diag("Error: Expected 2017-07-02");
return FAIL;
}
if (tm.minute | tm.second || tm.second_part)
{
diag("Error: minute, second or second_part is not zero");
return FAIL;
}
mysql_stmt_close(stmt);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_compress", test_compress, TEST_CONNECTION_NEW, CLIENT_COMPRESS, NULL, NULL},
{"test_codbc138", test_codbc138, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc208", test_conc208, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_mdev14165", test_mdev14165, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc208", test_conc208, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},