Fossil SCM

/json/finfo now sorts ASC when --after is specified.

stephan 2012-03-18 16:36 trunk
Commit 5dcaeca7c1f146d642f40bd05f4fb854d9066c80
1 file changed +3 -1
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -36,10 +36,11 @@
3636
char const * zAfter = NULL;
3737
char const * zBefore = NULL;
3838
int limit = -1;
3939
int currentRow = 0;
4040
char const * zCheckin = NULL;
41
+ char sort = -1;
4142
if(!g.perm.Read){
4243
json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
4344
return NULL;
4445
}
4546
json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change.");
@@ -95,16 +96,17 @@
9596
blob_appendf(&sql, " AND ci.uuid='%q'", zU);
9697
free(zU);
9798
}else{
9899
if( zAfter && *zAfter ){
99100
blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter);
101
+ sort = 1;
100102
}else if( zBefore && *zBefore ){
101103
blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore);
102104
}
103105
}
104106
105
- blob_appendf(&sql," ORDER BY event.mtime DESC /*sort*/");
107
+ blob_appendf(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC"));
106108
/*printf("SQL=\n%s\n",blob_str(&sql));*/
107109
db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding
108110
SQL escapes*/);
109111
blob_reset(&sql);
110112
111113
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -36,10 +36,11 @@
36 char const * zAfter = NULL;
37 char const * zBefore = NULL;
38 int limit = -1;
39 int currentRow = 0;
40 char const * zCheckin = NULL;
 
41 if(!g.perm.Read){
42 json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
43 return NULL;
44 }
45 json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change.");
@@ -95,16 +96,17 @@
95 blob_appendf(&sql, " AND ci.uuid='%q'", zU);
96 free(zU);
97 }else{
98 if( zAfter && *zAfter ){
99 blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter);
 
100 }else if( zBefore && *zBefore ){
101 blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore);
102 }
103 }
104
105 blob_appendf(&sql," ORDER BY event.mtime DESC /*sort*/");
106 /*printf("SQL=\n%s\n",blob_str(&sql));*/
107 db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding
108 SQL escapes*/);
109 blob_reset(&sql);
110
111
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -36,10 +36,11 @@
36 char const * zAfter = NULL;
37 char const * zBefore = NULL;
38 int limit = -1;
39 int currentRow = 0;
40 char const * zCheckin = NULL;
41 char sort = -1;
42 if(!g.perm.Read){
43 json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
44 return NULL;
45 }
46 json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change.");
@@ -95,16 +96,17 @@
96 blob_appendf(&sql, " AND ci.uuid='%q'", zU);
97 free(zU);
98 }else{
99 if( zAfter && *zAfter ){
100 blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter);
101 sort = 1;
102 }else if( zBefore && *zBefore ){
103 blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore);
104 }
105 }
106
107 blob_appendf(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC"));
108 /*printf("SQL=\n%s\n",blob_str(&sql));*/
109 db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding
110 SQL escapes*/);
111 blob_reset(&sql);
112
113

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button