Name
mysql_list_tables()
Synopsis
MYSQL_RES *mysql_list_tables(MYSQL *mysql,
const char *expression)This function 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. Here
is an example:
...
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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access