In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "data structure of MySQL database operation results". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the data structure of MySQL database operation results.
I. data structure of database operation results
Struct zbx_db_result
{
# if defined (HAVE_IBM_DB2)
SQLHANDLE hstmt
SQLSMALLINT nalloc
SQLSMALLINT ncolumn
DB_ROW values
DB_ROW values_cli
SQLINTEGER * values_len
# elif defined (HAVE_MYSQL)
MYSQL_RES * result
# elif defined (HAVE_ORACLE)
OCIStmt * stmthp; / * the statement handle for select operations * /
Int ncolumn
DB_ROW values
Ub4 * values_alloc
OCILobLocator * * clobs
# elif defined (HAVE_POSTGRESQL)
PGresult * pg_result
Int row_num
Int fld_num
Int cursor
DB_ROW values
# elif defined (HAVE_SQLITE3)
Int curow
Char * * data
Int nrow
Int ncolumn
DB_ROW values
# endif
}
The database is queried according to sql
/ *
* *
* Function: DBselect *
* *
* Purpose: execute a select statement *
* *
* Comments: retry until DB is up *
* *
* * /
DB_RESULT _ _ zbx_DBselect (const char * fmt,...)
{
Va_list args; / / Parameter list
DB_RESULT rc
Va_start (args, fmt)
Rc = zbx_db_vselect (fmt, args)
While ((DB_RESULT) ZBX_DB_DOWN = = rc)
{
DBclose ()
DBconnect (ZBX_DB_CONNECT_NORMAL)
If ((DB_RESULT) ZBX_DB_DOWN = (rc = zbx_db_vselect (fmt, args)
{
Zabbix_log (LOG_LEVEL_ERR, "database is down: retrying in% d seconds", ZBX_DB_WAIT_DOWN)
Connection_failure = 1
Sleep (ZBX_DB_WAIT_DOWN)
}
}
Va_end (args)
Return rc
}
3. Data structure of MySQL operation result
Typedef struct st_mysql_res {
My_ulonglong row_count
MYSQL_FIELD * fields
MYSQL_DATA * data
MYSQL_ROWS * data_cursor
Unsigned long * lengths; / * column lengths of current row * /
MYSQL * handle; / * for unbuffered reads * /
Const struct st_mysql_methods * methods
MYSQL_ROW row; / * If unbuffered read * /
MYSQL_ROW current_row; / * buffer to current row * /
MEM_ROOT field_alloc
Unsigned int field_count, current_field
My_bool eof; / * Used by mysql_fetch_row * /
/ * mysql_stmt_close () had to cancel this result * /
My_bool unbuffered_fetch_cancelled
Void * extension
} MYSQL_RES
Thank you for your reading, the above is the content of "data structure of MySQL database operation results". After the study of this article, I believe you have a deeper understanding of the data structure of MySQL database operation results, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.