Skip to content

Commit

Permalink
Fix for CONC-160: field metadata doesn't show NUM_FLAG for NEWDECIMAL
Browse files Browse the repository at this point in the history
columns
  • Loading branch information
9EOR9 committed Feb 20, 2016
1 parent f1cde3d commit 52e07f5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/mysql.h
Expand Up @@ -87,7 +87,7 @@ extern unsigned int mariadb_deinitialize_ssl;
#define IS_BLOB(n) ((n) & BLOB_FLAG)
#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR || (f)->type == MYSQL_TYPE_NEWDECIMAL || (f)->type == MYSQL_TYPE_DECIMAL)

typedef struct st_mysql_field {
char *name; /* Name of column */
Expand Down
19 changes: 19 additions & 0 deletions unittest/libmariadb/result.c
Expand Up @@ -1026,9 +1026,28 @@ DROP TABLE IF EXISTS test_multi_tab";
return OK;
}

static int test_conc160(MYSQL *mysql)
{
MYSQL_RES *result;
MYSQL_FIELD *field;
int rc;

rc= mysql_query(mysql, "SELECT cast(1.234 AS DECIMAL)");
check_mysql_rc(rc, mysql);

result= mysql_store_result(mysql);
field= mysql_fetch_field(result);

FAIL_UNLESS(field->flags & NUM_FLAG, "Numceric flag not set");

mysql_free_result(result);
return OK;
}



struct my_tests_st my_tests[] = {
{"test_conc160", test_conc160, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"client_store_result", client_store_result, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"client_use_result", client_use_result, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_free_result", test_free_result, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
Expand Down
2 changes: 1 addition & 1 deletion unittest/libmariadb/ssl.c.in
Expand Up @@ -697,7 +697,7 @@ static int test_ssl_fp_list(MYSQL *unused)

struct my_tests_st my_tests[] = {
{"test_ssl", test_ssl, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc127", test_conc127, TEST_CONNECTION_NEW, 0, NULL, NULL},
// {"test_conc127", test_conc127, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_ssl_fp", test_ssl_fp, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_ssl_fp_list", test_ssl_fp_list, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc50", test_conc50, TEST_CONNECTION_NEW, 0, NULL, NULL},
Expand Down

0 comments on commit 52e07f5

Please sign in to comment.