diff --git a/src/modules/mysql/doc/mysql b/src/modules/mysql/doc/mysql index 5065f56be2e37592781cb81c5b8eb6cff74f265d..8732a8c99eda8be12557590c29448088364b893e 100644 --- a/src/modules/mysql/doc/mysql +++ b/src/modules/mysql/doc/mysql @@ -320,7 +320,7 @@ DESCRIPTION "type": string The type of the field. "length": int The length of the field. "max_length": int The length of the longest element in this field. - "flags": int Some flags. + "flags": multiset(string) Some flags. "decimals": int The number of decimalplaces. The type of the field can be any of: @@ -328,9 +328,14 @@ DESCRIPTION "time", "longlong", "int24", "tiny blob", "medium blob", "long blob", "var string", "string" or "unknown". + The flags multiset can contain any of + "primary_key": This field is part of the primary key for this table. + "not_null": This field may not be NULL. + "blob": This field is a blob field. + NOTA BENE Michael Widenius recomends usage of the following query instead: - show fields in 'table' like "wild" + show fields in 'table' like "wild" SEE ALSO mysql->list_dbs, mysql->list_tables, mysql->list_processes, diff --git a/src/modules/mysql/result.c b/src/modules/mysql/result.c index 19e96ff369ab37068060a7017b88b1c6cd9750be..d2d52634c81a0361da6ca42b9fc6f796ec9ce39c 100644 --- a/src/modules/mysql/result.c +++ b/src/modules/mysql/result.c @@ -1,5 +1,5 @@ /* - * $Id: result.c,v 1.10 1997/01/15 21:00:30 grubba Exp $ + * $Id: result.c,v 1.11 1997/01/24 01:46:38 grubba Exp $ * * mysql query result * @@ -62,7 +62,7 @@ typedef struct dynamic_buffer_s dynamic_buffer; * Globals */ -RCSID("$Id: result.c,v 1.10 1997/01/15 21:00:30 grubba Exp $"); +RCSID("$Id: result.c,v 1.11 1997/01/24 01:46:38 grubba Exp $"); struct program *mysql_result_program = NULL; @@ -94,6 +94,7 @@ static void exit_res_struct(struct object *o) void mysqlmod_parse_field(MYSQL_FIELD *field, int support_default) { if (field) { + int nbits = 0; push_text("name"); push_text(field->name); push_text("table"); push_text(field->table); if (support_default) { @@ -160,7 +161,22 @@ void mysqlmod_parse_field(MYSQL_FIELD *field, int support_default) } push_text("length"); push_int(field->length); push_text("max_length"); push_int(field->max_length); - push_text("flags"); push_int(field->flags); /*************/ + + push_text("flags"); + if (IS_PRI_KEY(field->flags)) { + nbits++; + push_text("primary_key"); + } + if (IS_NOT_NULL(field->flags)) { + nbits++; + push_text("not_null"); + } + if (IS_BLOB(field->flags)) { + nbits++; + push_text("blob"); + } + f_aggregate_multiset(nbits); + push_text("decimals"); push_int(field->decimals); if (support_default) {