MYSQL * m_pstConn; // connection to the established MySQL database
// Obtain the table name
MYSQL_ROW tbl;
MYSQL_RES * pResultSet = NULL;
PResultSet = mysql_list_tables (m_pstConn, NULL );
While (tbl = mysql_fetch_row (pResultSet ))
{
Printf ("table: % s \ n", tbl [0]);
}
// Obtain the Database Name
MYSQL_ROW db;
MYSQL_RES * pResultSet = NULL;
PResultSet = mysql_list_dbs (m_pstConn, NULL );
While (db = mysql_fetch_row (pResultSet ))
{
Printf ("db: % s \ n", db [0]);
}
// Obtain the field name
MYSQL_FIELD * tbl;
MYSQL_RES * pResultSet = NULL;
PResultSet = mysql_list_fields (m_pstConn, "test_log", NULL );
While (tbl = mysql_fetch_field (pResultSet ))
{
Printf ("db: % s \ n", tbl [0]);
}
// Obtain the field name
MYSQL_FIELD * tbl;
MYSQL_RES * pResultSet = NULL;
Mysql_query (m_pstConn, "select * from test_log ");
PResultSet = mysql_store_result (m_pstConn );
While (tbl = mysql_fetch_field (pResultSet ))
{
Printf ("db: % s \ n", tbl [0]);
}
// Obtain the field information
MYSQL_FIELD * tbl;
MYSQL_RES * pResultSet = NULL;
Mysql_query (m_pstConn, "select * from test_log ");
PResultSet = mysql_store_result (m_pstConn );
While (tbl = mysql_fetch_field (pResultSet ))
{
Printf ("db: % s, % d, % d, % s \ n", tbl [0], tbl-> type, tbl-> flags, tbl-> name );
}