dav/main.c

changeset 135
664aeaec8d25
parent 126
b156cae29e65
child 136
59058927b885
--- a/dav/main.c	Tue Jul 07 20:47:02 2015 +0200
+++ b/dav/main.c	Wed Jul 08 17:31:26 2015 +0200
@@ -50,18 +50,11 @@
     // nothing
 }
 
-#define DO_THE_TEST
+//define DO_THE_TEST
 #include <libidav/davqlparser.h>
 #include <libidav/davqlexec.h>
 void test() {
-    DavQLStatement *stmt = dav_parse_statement(S(
-        "get * from / where lastmodified > 12"));
     
-    DavSession *sn = dav_session_new(ctx, "http://test/");
-    dav_statement_exec(sn, stmt, 123, "txt");
-    
-    //dav_debug_statement(stmt);
-    dav_free_statement(stmt);
 }
 
 int main(int argc, char **argv) {
@@ -371,7 +364,7 @@
     }
     
     char *update = cmd_getoption(a, "update");
-    time_t t = -1;
+    time_t t = 1;
     if(update) {
         t = util_parse_lastmodified(update);
     }
@@ -380,12 +373,15 @@
     int ret = -1;
     DavResource *ls;
     while(ret != 0) {
+        /*
         ls = dav_query(
                 sn,
-                "get idav:crypto-name,idav:crypto-key from %s where lastmodified > %t with depth %d",
+                "select `idav:crypto-name`,`idav:crypto-key` from %s with depth = %d where lastmodified > %t",
                 path,
-                t,
-                depth);
+                depth,
+                t);
+        */
+        ls = dav_query(sn, "select * from %s", path);
         
         if(!ls) {
             if(sn->error == DAV_UNAUTHORIZED) {
@@ -405,6 +401,7 @@
         } else {
             print_func = ls_print_elm;
         }
+        
         DavResource *child = ls->children;
         while(child) {
             if(child->name[0] != '.' || show_all) {
@@ -594,7 +591,7 @@
     }
     
     char *update = cmd_getoption(a, "update");
-    time_t t = 0;
+    time_t t = -1;
     if(update) {
         t = util_parse_lastmodified(update);
     }
@@ -605,7 +602,7 @@
     int depth = recursive ? -1 : 1;
     res = dav_query(
             sn,
-            "get - from %s where lastmodified > %t with depth %d",
+            "select - from %s with = depth %d where lastmodified > %t",
             path,
             t,
             depth);
@@ -797,7 +794,7 @@
 }
 
 int put_file(Repository *repo, CmdArgs *a, DavSession *sn, char *path, char *name, FILE *in) {
-    DavResource *res = dav_query(sn, "get - from %s", path);
+    DavResource *res = dav_query(sn, "select - from %s", path);
     if(!res) {
         if(sn->error == DAV_NOT_FOUND) {
             res = dav_resource_new(sn, path);

mercurial