From: Norbert Moutarde Date: Tue, 23 Jul 2013 10:30:43 +0000 (+0200) Subject: I've transform my default func (in c++) to 'default' alias in SQL X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=da7f84df3a1841edfedfe211a2c2bacb84cb26af;p=diary-shell I've transform my default func (in c++) to 'default' alias in SQL --- diff --git a/main.cpp b/main.cpp index d3a05a2..b2bd31e 100644 --- a/main.cpp +++ b/main.cpp @@ -55,7 +55,11 @@ do{ } else if (diary.alias(words)); else { - diary.insert(words); + std::vector myvector (3,100); + vector::iterator it; + it = words.begin(); + it = words.insert ( it , "default"); + diary.alias(words); } words.clear(); }while(1); diff --git a/sqldb.cpp b/sqldb.cpp index a6fa671..2953cd9 100644 --- a/sqldb.cpp +++ b/sqldb.cpp @@ -49,10 +49,8 @@ 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 : "< text) { value[0]=a.c_str(); length[0]=a.size(); binary[0]=0; - //tmp=text[2]; value[1]=tmp.c_str(); length[1]=tmp.size(); binary[1]=0; - //command="INSERT INTO raw (date, texte) VALUES ('now()', '"+tmp+"')"; - }; } else { @@ -131,11 +126,9 @@ int sqlpg::insert(vector text) { binary[1]=0; clog<<"text.size()<2 finish\n"; }; - //res=PQexecParams(conn, command.c_str(), argc, NULL, value, length, binary, 0); res=PQexecPrepared(conn, "insert", argc, value, length, binary, 0); testSQL(res); clog<<"insert(vector) end\n"; - //exec(command); return 0; } @@ -170,7 +163,7 @@ int sqlpg::hmRecord(){ //res=PQexec(conn, command.c_str()); exec(command); a=PQntuples(res); - clog<<"hmRecord()="<