From a1d362d7625471d3945f38e8a857e43679f2edd4 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Tue, 23 Jul 2013 08:10:53 +0200 Subject: [PATCH] i've added some command in alias (and i've forget what I've done in sqldb) --- alias.sql | 4 +++- sqldb.cpp | 1 - sqldb.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/alias.sql b/alias.sql index e4ed9af..b6702a7 100644 --- 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'); diff --git a/sqldb.cpp b/sqldb.cpp index 405d976..292f57d 100644 --- a/sqldb.cpp +++ b/sqldb.cpp @@ -360,5 +360,4 @@ void sqlpg::getvar(){ clog<<"value.size="<); 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::mapvalue; + }; #endif // SQLDB_H -- 2.45.1