]> git.nothing2do.fr Git - diary-shell.git/commitdiff
added alias.sql
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 28 Jun 2013 10:10:45 +0000 (12:10 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 28 Jun 2013 10:10:45 +0000 (12:10 +0200)
README.md
alias.sql [new file with mode: 0644]
main.cpp
sqldb.cpp
tables1.sql

index 5c4eb54bd552b9e2ea913b374fa7d2a5a00dc028..86eaf52eb8fec887f9b668d95acba74df584c10d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,5 +4,7 @@ diary-shell
 a modern diary
 
 to get a full source tree, type : git clone https://github.com/Nothing2Do.eu/diary-shell.git
+
 cd to diary-shell, ./howto-compile.sh should compile it under diary-shell !
+
 to put you modification to the server : "git commit -a" and "git push"
diff --git a/alias.sql b/alias.sql
new file mode 100644 (file)
index 0000000..55d761d
--- /dev/null
+++ b/alias.sql
@@ -0,0 +1 @@
+INSERT INTO alias (nom, cmd, argc) VALUES ('ls', 'select id,texte from raw order by date asc;', 0)
index c03a134a21f5adff607b232681d69ab73e2235fb..777803e6123ea41e1c3c7bf550d4531efb6ba7ed 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -71,7 +71,6 @@ do{
         diary.exec(a);
         diary.print();
     }
-    /* alias (select command from alias where 'nom'=string */
     else if (diary.alias(words));
     else {
         diary.insert(words);
index 81b851b36baa1059a7d1b78f5ae52e51f54c1161..df514a9832cf0f69caaacc6c94d645ee15d5dee8 100644 (file)
--- a/sqldb.cpp
+++ b/sqldb.cpp
@@ -219,7 +219,7 @@ res = PQexecParams(conn,
     int         paramLengths[1];
     int         paramFormats[1];
     //uint32_t    binaryIntVal;
-paramValues[0]=a[1].c_str();
+    paramValues[0]=a[1].c_str();
     res = PQexecParams(conn,
                        "SELECT * FROM raw WHERE texte like %$1%",
                        1,       /* one param */
@@ -246,7 +246,7 @@ bool sqlpg::alias(vector<string> a){
     if (PQntuples(res)<1)return 0;
     string cmd2;
     cmd2=PQgetvalue(res, 0, 0);
-    //cout<<"cmd2="<<cmd2<<endl;
+    cout<<"cmd2="<<cmd2<<endl;
     int pos=0;
     stringstream tmp;
     int argc;
index 5b044c58eac73581aa2343253428fa318880911a..370ccfa201531a6d69df27b4e57c3f8bd82d760f 100755 (executable)
@@ -2,17 +2,17 @@
 --CREATE DATABASE bob OWNER bob;
 
 create table words (
-id serial,
+id serial primary key,
 time integer,
-txt text
-); 
+word text
+);
 
 create table alias (
 id serial primary key,
-command text,
+cmd text,
 argc integer,
 nom text
-); 
+);
 
 create table raw (
 id serial primary key,