]> git.nothing2do.fr Git - diary-shell/commitdiff
i've added some command in alias (and i've forget what I've done in sqldb)
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 23 Jul 2013 06:10:53 +0000 (08:10 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 23 Jul 2013 06:10:53 +0000 (08:10 +0200)
alias.sql
sqldb.cpp
sqldb.h

index e4ed9af65cd1f3508ff8b03c56e89def035ea4b6..b6702a79d6b181eef7f2e1320ec47f722e5f1d0e 100644 (file)
--- a/alias.sql
+++ b/alias.sql
@@ -1,8 +1,10 @@
+insert into alias (nom, cmd, argc, help) values ('tables', 'select tablename from pg_tables', 0, 'list table (every table...)');
 INSERT INTO alias (nom, cmd, argc, help) VALUES ('ls', 'select id,texte from raw order by date asc;', 0, 'list id,text of every records');
 insert into alias (nom, cmd, argc, help) values ('ls', 'select * from raw where id=$1 order by date asc;', 1, 'print id,date,text of one record');
 insert into alias (nom, cmd, argc, help) values ('ls', 'select * from raw where date between $1 and $2 order by date asc;', 2, 'liste record with date between $1 and $2');
 INSERT INTO alias (nom, cmd, 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 arg)');
 INSERT INTO alias (nom, cmd, argc, help) VALUES ('rm', 'DELETE FROM raw WHERE id =$1;', 1, 'delete record by ID');
+INSERT INTO alias (nom, cmd, argc, help) VALUES ('rmm', 'DELETE FROM memo WHERE id =$1;', 1, 'delete record by ID');
 insert into alias (nom, cmd, argc, help) values ('var', 'select nom from var', 0, 'print avery var');
 insert into alias (nom, cmd, argc, help) values ('var', 'select value from var where nom=$1', 1, 'print named var content');
 insert into alias (nom, cmd, argc, inf, help) values ('var', 'insert into var (nom, value) values ($1, $2)', 2, '1', 'add new var and it''s content');
@@ -10,7 +12,7 @@ insert into alias (nom, cmd, argc, inf, help) values ('memo', 'insert into memo
 insert into alias (nom, cmd, argc, help) values ('memo', 'select distinct word from memo', 0, 'list all word with memo attached');
 insert into alias (nom, cmd, argc, help) values ('memo', 'select id,rem from memo where word=$1 order by id', 1, 'print memo content');
 insert into alias (nom, cmd, argc, help) values ('help', 'select distinct nom from alias', 0, 'help itself (add "cmd" to get specific help)');
-insert into alias (nom, cmd, argc, help) values ('help', 'select argc from alias where nom=$1 order by argc', 1, 'print id,argc of named alias by ID');
+insert into alias (nom, cmd, argc, help) values ('help', 'select argc from alias where nom=$1 order by argc', 1, 'print argc of named alias by ID');
 insert into alias (nom, cmd, argc, help) values ('help', 'select help from alias where nom=$1 and argc=$2', 2, 'print help for only one alias (as "nom" and "argc" is a key)');
 insert into alias (nom, cmd, argc, help) values ('print', 'select cmd,inf from alias where nom=$1 and argc=$2', 2, 'print SQL command of an alias (...)');
 insert into alias (nom, cmd, argc, inf, help) values ('default', 'INSERT INTO raw (date, texte) VALUES ($1::timestamp, $2::text);', 2 , '1', 'default command');
index 405d976536122ffe9277c81f1738e7924f0e1833..292f57d5080d54f9a73422743fa4caa299038487 100644 (file)
--- a/sqldb.cpp
+++ b/sqldb.cpp
@@ -360,5 +360,4 @@ void sqlpg::getvar(){
     clog<<"value.size="<<value.size();
 };
 
-
 #endif
diff --git a/sqldb.h b/sqldb.h
index 816c575d6d8edc40508d07768a8ec8f57d309d4c..4a7801355e140faea04193519d246eae38fc0011 100644 (file)
--- a/sqldb.h
+++ b/sqldb.h
@@ -27,6 +27,7 @@ public:
     void exec(std::string);
     bool alias(std::vector<std::string>);
     void compulse();//populate table words
+
 private:
     PGconn *conn;
     PGresult *res, *res2, *res3;
@@ -34,6 +35,7 @@ private:
     std::string b, date, connect;
     int a;
     std::map<std::string,std::string>value;
+
 };
 
 #endif // SQLDB_H