diff options
author | unknown <hf@deer.(none)> | 2003-09-11 09:46:31 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2003-09-11 09:46:31 +0500 |
commit | d6f15e9d02d7fb33627c937ff47c948dd9ae0b2e (patch) | |
tree | 538cb9bd71ffb376946c4f646c4b2ebb67844cb1 /libmysqld/libmysqld.c | |
parent | 565d92210eb23c973b0eff9796e21cec611666dc (diff) | |
download | mariadb-git-d6f15e9d02d7fb33627c937ff47c948dd9ae0b2e.tar.gz |
SCRUM
embedded&client library
some fixes: zero at the end of the data added
mysql_list_fields became 'virtual'
include/mysql.h:
mysql_list_fields became 'virtual'
libmysql/client_settings.h:
in client library we need proper implementation for list_fields
libmysql/libmysql.c:
implementation for remote server
libmysqld/lib_sql.cc:
we still need zero at the end of the data in client (see mysql.cc).
I feel it should be changed
libmysqld/libmysqld.c:
implementation for embedded server
sql-common/client.c:
cli_list_fields member set for client library
sql/client_settings.h:
we don't need mysql_list_fields in mini_client code
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r-- | libmysqld/libmysqld.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 7ac723f3050..f403400812f 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -179,6 +179,39 @@ static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_co *to= *column ? *(uint *)((*column) - sizeof(uint)) : 0; } +/************************************************************************** + List all fields in a table + If wild is given then only the fields matching wild is returned + Instead of this use query: + show fields in 'table' like "wild" +**************************************************************************/ + +static MYSQL_RES * STDCALL +emb_list_fields(MYSQL *mysql, const char *table, const char *wild) +{ + MYSQL_RES *result; + MYSQL_DATA *query; + char buff[257],*end; + DBUG_ENTER("mysql_list_fields"); + DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : "")); + + LINT_INIT(query); + + end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128); + if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1)) + DBUG_RETURN(NULL); + + result= mysql->result; + if (!result) + return 0; + + result->methods= mysql->methods; + result->eof=1; + + DBUG_RETURN(result); +} + + /* ** Note that the mysql argument must be initialized with mysql_init() @@ -195,7 +228,8 @@ static MYSQL_METHODS embedded_methods= emb_advanced_command, emb_mysql_store_result, emb_mysql_use_result, - emb_fetch_lengths + emb_fetch_lengths, + emb_list_fields }; MYSQL * STDCALL |