From: Norbert Moutarde Date: Sun, 14 Jul 2013 09:25:33 +0000 (+0200) Subject: help subsystem is nom SQL'ed ! X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=79eae0731a8cafe8fba6a3beebb0b02e7deaa936;p=diary-shell help subsystem is nom SQL'ed ! --- diff --git a/alias.sql b/alias.sql index 4237b80..e79e4c3 100644 --- a/alias.sql +++ b/alias.sql @@ -1,11 +1,13 @@ -INSERT INTO alias (nom, command, argc) VALUES ('ls', 'select id,texte from raw order by date asc;', 0); +INSERT INTO alias (nom, command, argc, help) VALUES ('ls', 'select id,texte from raw order by date asc;', 0, 'liste les enregistrement (select by ID, between 2 date, everyone)'); insert into alias (nom, command, argc) values ('ls', 'select * from raw where id=$1 order by date asc;', 1); insert into alias (nom, command, argc) values ('ls', 'select * from raw where date between $1 and $2 order by date asc;', 2); -INSERT INTO alias (nom, command, argc) VALUES ('search', 'select id,texte from raw where texte ~ $1 order by date asc;', 1); -INSERT INTO alias (nom, command, argc) VALUES ('rm', 'DELETE FROM raw WHERE id =$1;', 1); -INSERT INTO alias (nom, command, argc) VALUES ('alias', 'select nom from alias;', 0); -insert into alias (nom, command, argc) values ('var', 'select nom from var', 0); -insert into alias (nom, command, argc) values ('var', 'select id,nom,value from var where nom=$1 order by id', 1); -insert into alias (nom, command, argc, inf) values ('memo', 'insert into memo (word, rem) values ($1, $2);', 1, '1'); +INSERT INTO alias (nom, command, argc, help) VALUES ('search', 'select id,texte from raw where texte ~ $1 order by date asc;', 1, 'search record who contains your arg (only one'); +INSERT INTO alias (nom, command, argc, help) VALUES ('rm', 'DELETE FROM raw WHERE id =$1;', 1, 'delete record by ID'); +INSERT INTO alias (nom, command, argc, help) VALUES ('alias', 'select nom from alias;', 0, 'print every alias''s name'); +insert into alias (nom, command, argc, help) values ('var', 'select nom from var', 0, 'print avery var/named var content'); +insert into alias (nom, command, argc) values ('var', 'select nom,value from var where nom=$1 order by id', 1); +insert into alias (nom, command, argc, inf, help) values ('memo', 'insert into memo (word, rem) values ($1, $2);', 1, '1', 'list memo''s name/record new one/'); insert into alias (nom, command, argc) values ('memo', 'select distinct word from memo', 0); -insert into alias (nom, command, argc) values ('mem', 'select id,rem from memo where word=$1 order by id', 1); +insert into alias (nom, command, argc, help) values ('mem', 'select id,rem from memo where word=$1 order by id', 1, 'print memo content'); +insert into alias (nom, command, argc, help) values ('help', 'select distinct nom from alias', 0, 'help itself (add "command to get specific help")'); +insert into alias (nom, command, argc) values ('help', 'select distinct id,nom,command from alias where nom=$1', 1); diff --git a/main.cpp b/main.cpp index a4494e4..c66d4a8 100644 --- a/main.cpp +++ b/main.cpp @@ -12,15 +12,6 @@ string date(string a)//transform any date format (in help) to "YYYY-MM-DD HH:MM: ss>>y>>"-">>m>>"-">>d>>" ">>h>>":">>m>>":">>s>>".">>x; return ss.str();*/ } -void help() -{ - - cout<<"command in c++ : value, print, status, help, alias (-/+list/+add), ! SQL...\n"; - cout<<"command in SQL : \n"; -} - - - int main(int argc, char *argv[]) { cout << "Début du programme '" << argv[0] << "'. Nombre de paramètres reçus : " << argc << endl; @@ -41,7 +32,7 @@ do{ if(words.size()==0)break;//quit else if (words[0]=="w") diary.exec(words); else if (words[0]=="p") diary.print(); - else if (words[0]=="help") help(); + //else if (words[0]=="help") diary.help(); now into SQL else if (words[0]=="status") diary.status(); else if (words[0]=="value") diary.var(); diff --git a/sqldb.cpp b/sqldb.cpp index b5c4851..4b5aed5 100644 --- a/sqldb.cpp +++ b/sqldb.cpp @@ -286,10 +286,11 @@ bool sqlpg::alias(vector a){ length[argc]=t.size(); binary[argc]=0; } + clog<<"if(inf=1) finish\n"; for(int k=0; k<(argc+inf); k++){ clog<<"value["<