Commit c520e39b authored by osku's avatar osku

dtype_print():

 Recognize DATA_FIXBINARY and DATA_BLOB types.

 Print known flags from prtype.

 Use a switch statement, not an else-if chain.
parent 56e3e9cf
......@@ -216,20 +216,43 @@ dtype_print(
mtype = type->mtype;
prtype = type->prtype;
if (mtype == DATA_VARCHAR) {
switch (mtype) {
case DATA_VARCHAR:
fputs("DATA_VARCHAR", stderr);
} else if (mtype == DATA_CHAR) {
break;
case DATA_CHAR:
fputs("DATA_CHAR", stderr);
} else if (mtype == DATA_BINARY) {
break;
case DATA_BINARY:
fputs("DATA_BINARY", stderr);
} else if (mtype == DATA_INT) {
break;
case DATA_FIXBINARY:
fputs("DATA_FIXBINARY", stderr);
break;
case DATA_BLOB:
fputs("DATA_BLOB", stderr);
break;
case DATA_INT:
fputs("DATA_INT", stderr);
} else if (mtype == DATA_MYSQL) {
break;
case DATA_MYSQL:
fputs("DATA_MYSQL", stderr);
} else if (mtype == DATA_SYS) {
break;
case DATA_SYS:
fputs("DATA_SYS", stderr);
} else {
break;
default:
fprintf(stderr, "type %lu", (ulong) mtype);
break;
}
len = type->len;
......@@ -254,6 +277,18 @@ dtype_print(
} else {
fprintf(stderr, "prtype %lu", (ulong) prtype);
}
} else {
if (prtype & DATA_UNSIGNED) {
fputs(" DATA_UNSIGNED", stderr);
}
if (prtype & DATA_BINARY_TYPE) {
fputs(" DATA_BINARY_TYPE", stderr);
}
if (prtype & DATA_NOT_NULL) {
fputs(" DATA_NOT_NULL", stderr);
}
}
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment