From: Norbert Moutarde Date: Tue, 23 Jul 2013 11:36:23 +0000 (+0200) Subject: lot of error, I give up X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=b972a81bf08b68f7cc76602c00fc65ab1ca2eb29;p=diary-shell.git lot of error, I give up --- diff --git a/main.cpp b/main.cpp index b2bd31e..e80db55 100644 --- a/main.cpp +++ b/main.cpp @@ -55,11 +55,11 @@ do{ } else if (diary.alias(words)); else { - std::vector myvector (3,100); - vector::iterator it; + /*vector::iterator it; it = words.begin(); it = words.insert ( it , "default"); - diary.alias(words); + diary.alias(words);*/ + diary.insert(words); } words.clear(); }while(1); diff --git a/sqldb.cpp b/sqldb.cpp index 2953cd9..327f0aa 100644 --- a/sqldb.cpp +++ b/sqldb.cpp @@ -17,12 +17,11 @@ sqlpg::sqlpg() { //conn = PQconnectStart(var.c_str()); conn = PQconnectdb(connect.c_str()); clog<<"prepare SQL statement\n"; - string cmd="select cmd,argc,inf from alias where ((nom = $1) and (argc = $2)) OR ((nom = $1) and (inf='1') and (argc < $2));"; + string cmd="select cmd,argc,inf from alias where ((nom = $1) and (argc = $2)) OR ((nom = $1) and (inf<>0) and (argc < $2));"; clog<<"SQL statement="< text) { else { clog<<"text.size()<2\n"; tmp=text[0]; - string a="now"; + a="now"; value[0]=a.c_str(); length[0]=a.size(); binary[0]=0; - for (int a=0;a text) { clog<<"insert(vector) end\n"; return 0; } - string sqlpg::now(int day){//day=0 return only HH:MM:SS, day=1 return YYYY-MM-DD HH:MM:SS, day=2 YYYY-MM-DD // current date/time based on current system time_t now = time(0); @@ -241,7 +239,8 @@ inline int sqlpg::testSQL(PGresult* a){ bool sqlpg::alias(vector a){ clog<<"alias start here\n"; string nom=a[0], as=toString(a.size()-1), i; - int argca=2, inf=0; + int argca=2; + bool inf=0; const char *valuea[2]={nom.c_str(), as.c_str()}; int lengtha[2]={nom.size(), as.size()}; int binarya[2]={0, 0}; @@ -253,7 +252,7 @@ bool sqlpg::alias(vector a){ } string cmd2; cmd2=PQgetvalue(res, 0, 0); - clog<<"commande : "<commande : "< a){ clog<<"for infinite finish t="<