[問題] c++ sql_query failed

看板C_and_CPP (C/C++)作者 (lantis)時間11年前 (2014/07/16 17:36), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
開發平台(Platform): Linux using CodeBlocks 額外使用到的函數庫(Library Used): MySQL library 問題(Question):我用c++ 使用 sql_query() 丟 double 讓他增加到sql table上 below is my code -------------------- bool mysqlinsert(double sqlinput){ MYSQL *conn_ptr; conn_ptr = mysql_init(NULL); if(!conn_ptr) { fprintf(stderr,"mysql_init failed\n"); //return EXIT_FAILURE; } conn_ptr = mysql_real_connect(conn_ptr,"localhost","root","nlpgroup","testdb",0,NULL,0); if(conn_ptr){ int abc; char sql_buffer[64] = {0}; sprintf(sql_buffer,"insert into EM1 (Prob) values(\"%f\")",sqlinput); if((abc = mysql_query(conn_ptr,sql_buffer))) { printf("error code:%s\n",mysql_error(conn_ptr)); } mysql_close(conn_ptr); return true; //connection succees } else printf("Connection failed\n"); mysql_close(conn_ptr); return false; //return EXIT_SUCCESS; } -------------------------------- 問題重點一開始還可以成功丟入也成功增加進入sql table 中 到一個數量之後 -> connection failed 想到可能是sql query 可能有限制次數 哪邊可調這些設定?(on Linux) **這些query 可能會達幾萬次 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.22.21.92 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1405503419.A.57D.html
文章代碼(AID): #1JnaUxLz (C_and_CPP)
文章代碼(AID): #1JnaUxLz (C_and_CPP)