From b8ff1fe2dfb04ac83f7faa146fcbb81611b3618a Mon Sep 17 00:00:00 2001 From: Saturneic Date: Sat, 2 Feb 2019 15:00:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=B8=AAbu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/cproj.h | 2 +- src/cproj_proj.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/cproj.h b/include/cproj.h index 7425768..10f8857 100644 --- a/include/cproj.h +++ b/include/cproj.h @@ -127,7 +127,7 @@ protected: void read_settings(string path, string &tstr){ struct stat tstat; stat(path.data(), &tstat); - Byte *fbs = (Byte *)malloc(tstat.st_size); + Byte *fbs = (Byte *)malloc(tstat.st_size+5); read_file(path, fbs,tstat.st_size); for(off_t i = 0; i < tstat.st_size; i++){ if(isgraph(fbs[i])) tstr += fbs[i]; diff --git a/src/cproj_proj.cpp b/src/cproj_proj.cpp index 678a95d..a61812f 100644 --- a/src/cproj_proj.cpp +++ b/src/cproj_proj.cpp @@ -1265,18 +1265,33 @@ void Proj::UpdateProcess(void){ sqlite3_finalize(psqlsmt); sqlite3_finalize(psqlsmt2); + sql_quote = "SELECT count(*) FROM functions WHERE name = ?1;"; sqlite3_prepare(psql, sql_quote.data(), -1, &psqlsmt, &pzTail); for(auto func : func_index){ sqlite3_bind_text(psqlsmt, 1, func.first.data(), -1, SQLITE_TRANSIENT); int rtn = sqlite3_step(psqlsmt); + if(rtn == SQLITE_DONE || rtn == SQLITE_ROW){ int if_find = sqlite3_column_int(psqlsmt, 0); if(!if_find){ write_func_info(func.first, func.second); - //write_args_info(func.first, func.second); + write_args_info(func.first, func.second); + /*sql_quote2 = "CREATE TABLE "+func.first+" (id INT PRIMARY KEY NOT NULL,type TEXT NOT NULL,idx INT NOT NULL,io INT NOT NULL,key TEXT,size INT NOT NULL);"; + sqlite3_prepare(psql, sql_quote2.data(), -1, &psqlsmt2, &pzTail); + sqlite3_step(psqlsmt2); + sqlite3_finalize(psqlsmt2);*/ + sqlite3_finalize(psqlsmt); + sqlite3_prepare(psql, sql_quote.data(), -1, &psqlsmt, &pzTail); + } } + else{ + const char *error = sqlite3_errmsg(psql); + int errorcode = sqlite3_extended_errcode(psql); + printf("Error: [%d]%s\n",errorcode,error); + + } sqlite3_reset(psqlsmt); sqlite3_clear_bindings(psqlsmt); }