In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the introduction to mysql programming to guide you with examples. I hope you can supplement and update some knowledge. If you have any other questions you need to know, you can continue to follow my updated article in the industry information.
# include
# include
# include
# include
/ unsigned int mysql_errno (MYSQL * mysql)
/ *
Int mysql_init (MYSQL * handle)
{
MYSQL tmphandle = (MYSQL) malloc (sizeof (MYSQL))
/ /.
/ /...
Handle = tmphandle
}
Int main ()
{
Int ret = 0, I = 0 ret mysql;MYSQL * connect = NULL; connect = mysql_init (& mysql); if (connect = = NULL) {ret = mysql_errno (& mysql); printf ("func mysql_init () err\ n"); return ret;} printf ("func mysql_init () ok\ n"); connect = mysql_real_connect (connect, "localhost", "root", "mysql", "pos", 0, NULL, 0) If (connect = = NULL) {ret = mysql_errno (& mysql); printf ("func mysql_init () err\ n"); return ret;} printf ("func mysql_real_connect () ok\ n"); / / query const char * query = "select * from emp"; ret = mysql_query (& mysql, query); if (ret! = 0) {ret = mysql_errno (& mysql); printf ("func mysql_query () err\ n"); return ret; } / / typedef char * * MYSQL_ROW; / * return data as array of strings * / typedef unsigned int MYSQL_FIELD_OFFSET; / * offset to current field * / / get the result set / / the result set can contain 10 rows of data MYSQL_RES * result= mysql_store_result (& mysql); if (result==NULL) {ret = mysql_errno (& mysql); printf ("func mysql_query () err\ n"); return ret } unsigned int num = mysql_field_count (& mysql); / / get the column MYSQL_FIELD * fields = mysql_fetch_fields (result) from the mysql handle; / / get the header address structure for (I = 0; I
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.