May 2005
Intermediate to advanced
352 pages
14h 39m
English
mysql_list_tables( )
MYSQL_RES *mysql_list_tables(MYSQL *mysql,
const char *expression)This returns a results set containing a list of tables in the
currently selected database. An expression may be given as the second
argument of the function to select tables whose names match a certain
pattern. The % or _ may be used
as wildcards. If NULL is given for the second argument, all tables in
the database will be returned.
...
MYSQL_RES *result;
MYSQL_ROW row;
...
result = mysql_list_tables(mysql, "w%");
while((row = mysql_fetch_row(result)) != NULL)
{ printf("%s \n", row[0]); }
mysql_free_result(result);
...This excerpt extracts a list of tables
beginning with the letter "w" using
the mysql_list_tables( ) function and stores the
results in the result
variable. Using the mysql_fetch_row( )
function, each row of the results set is stored temporarily in the
row variable for printing.
Read now
Unlock full access