From: Norbert Moutarde Date: Tue, 23 Jul 2013 07:59:11 +0000 (+0200) Subject: I've tryed to put the default command into SQL (but this isn't done) X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=f4e0b883512b0586ce4b37b71cd8bd9f9ce9156d;p=diary-shell I've tryed to put the default command into SQL (but this isn't done) --- diff --git a/sqldb.cpp b/sqldb.cpp index 292f57d..a6fa671 100644 --- a/sqldb.cpp +++ b/sqldb.cpp @@ -50,20 +50,21 @@ template string sqlpg::toString( const T & Value ){ int sqlpg::insert(vector text) { clog<<"insert(vector) begin\n"; + string command="INSERT INTO raw (date, texte) VALUES ($1::timestamp, $2::text);";/*PQgetvalue(res, 0, 0);*/ + clog<<"commande : "<2){ if ((isdate(text[0]))+(isdate(text[1]))==3){ clog<<"text[0]+text[1]==3(L55)\n"; date=text[0]; - string a=date+" "+text[1]; + a=date+" "+text[1]; value[0]=a.c_str(); length[0]=a.size(); binary[0]=0; @@ -80,7 +81,7 @@ int sqlpg::insert(vector text) { else if((text[0]=="-")&&(isdate(text[1])==2)){ clog<<"date partielle(L72)\n"; tmp=text[2]; - string a=date+" "+text[1]; + a=date+" "+text[1]; value[0]=a.c_str(); length[0]=a.size(); binary[0]=0; @@ -95,9 +96,12 @@ int sqlpg::insert(vector text) { } else{ - clog<<"text.size()>2 && text[0] & text[1] isn't date. L89"; + clog<<"text.size()>2 && text[0] & text[1] isn't date. L101"; tmp=text[0]; - string a="1971-11-11 22:22:22"; + a="now"; + for (int i=1;i text) { value[1]=tmp.c_str(); length[1]=tmp.size(); binary[1]=0; - for (int a=1;a