From 9dd9b2fcdd1e0b0b94703e3f0ce864e1c3e62a66 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Fri, 28 Jun 2013 13:30:28 +0200 Subject: [PATCH] some command transferred into alias.sql --- alias.sql | 5 ++++- main.cpp | 10 +--------- sqldb.cpp | 44 -------------------------------------------- 3 files changed, 5 insertions(+), 54 deletions(-) diff --git a/alias.sql b/alias.sql index 55d761d..ffa0f1d 100644 --- a/alias.sql +++ b/alias.sql @@ -1 +1,4 @@ -INSERT INTO alias (nom, cmd, argc) VALUES ('ls', 'select id,texte from raw order by date asc;', 0) +INSERT INTO alias (nom, cmd, argc) VALUES ('ls', 'select id,texte from raw order by date asc;', 0); +INSERT INTO alias (nom, cmd, argc) VALUES ('search', 'select id, texte from raw where texte like \'%1\' order by date asc', 1); +INSERT INTO alias (nom, cmd, argc) VALUES ('rm', 'DELETE FROM raw WHERE id =\'%1\';', 1); +INSERT INTO alias (nom, cmd, argc) VALUES ('alias', 'select nom from alias;', 0); diff --git a/main.cpp b/main.cpp index 777803e..def8c0c 100644 --- a/main.cpp +++ b/main.cpp @@ -41,15 +41,7 @@ do{ else if (words[0]=="p") diary.print(); else if (words[0]=="help") help(); else if (words[0]=="status") diary.status(); - else if (words[0]=="rm"){// little useless - if (words.size()==2){// cmd : rm "id" - diary.deletetuple(words[1]); - } - else if (words.size()==3){// cmd : rm "date1" "date2" - string date1=words[1], date2=words[2]; - diary.deletedate(date1, date2); - } - } + else if (words[0]=="var") diary.var(); else if (words[0]=="now") cout< text) { exec(command); return 0; } -vector< vector > sqlpg::list(string a){ - vector tmp; - string command; - ret.clear(); - command="SELECT * FROM "+a+" ORDER BY date ASC;";//PQfname(res, 0) can't works here ! - - //cout< > sqlpg::listdate(string begin, string end){ - vector tmp; - string command; - ret.clear(); - command="SELECT * FROM raw WHERE date BETWEEN '"+begin+"' AND '"+end+"';"; - //cout<