Fossil

Check-in [6ee6486e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:minor cleanups.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json
Files: files | file ages | folders
SHA1:6ee6486e02c584f8fca772423c531ad45a6da584
User & Date: stephan 2011-10-01 05:58:17
Context
2011-10-01
05:58
Started adding artifact-type-dependent result data to /json/artifact output. check-in: a893fff3 user: stephan tags: json-multitag-test, json
05:58
minor cleanups. check-in: 6ee6486e user: stephan tags: json
05:57
Added json_new_int() convenience function. check-in: ccd66b9b user: stephan tags: json
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json_timeline.c.

186
187
188
189
190
191
192
193
194
195
196
197





198
199
200
201
202
203
204
205
  blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType);
  json_timeline_add_time_clause(pSql);
  limit = json_timeline_limit();
  if(limit){
    blob_appendf(pSql,"LIMIT %d ",limit);
  }
  if(pPayload){
    cson_object_set(pPayload, "limit",cson_value_new_integer(limit));
  }

}






static cson_value * json_timeline_get_changed_files(int rid){
  cson_value * rowsV = NULL;
  cson_array * rows = NULL;
  Stmt q;
  db_prepare(&q, 
#if 0
             "SELECT (mlink.pid==0) AS isNew,"
             "       (mlink.fid==0) AS isDel,"







|




>
>
>
>
>
|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
  blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType);
  json_timeline_add_time_clause(pSql);
  limit = json_timeline_limit();
  if(limit){
    blob_appendf(pSql,"LIMIT %d ",limit);
  }
  if(pPayload){
    cson_object_set(pPayload, "limit",json_new_int(limit));
  }

}

/*
** If any files are associated with the given rid, a JSON array
** containing information about them is returned (and is owned by the
** caller). If no files are associated with it then NULL is returned.
*/
cson_value * json_timeline_get_changed_files(int rid){
  cson_value * rowsV = NULL;
  cson_array * rows = NULL;
  Stmt q;
  db_prepare(&q, 
#if 0
             "SELECT (mlink.pid==0) AS isNew,"
             "       (mlink.fid==0) AS isDel,"

Changes to src/json_wiki.c.

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    unsigned int len;
    cson_value * payV = cson_value_new_object();
    cson_object * pay = cson_value_get_object(payV);
    cson_object_set(pay,"name",json_new_string(zPageName));
    cson_object_set(pay,"uuid",json_new_string(zUuid));
    free(zUuid);
    zUuid = NULL;
    cson_object_set(pay,"rid",cson_value_new_integer((cson_int_t)rid));
    cson_object_set(pay,"lastSavedBy",json_new_string(pWiki->zUser));
    cson_object_set(pay,FossilJsonKeys.timestamp, json_julian_to_timestamp(pWiki->rDate));
    cson_object_set(pay,"contentFormat",json_new_string(zFormat));
    if( ('h'==*zFormat) ){
      Blob content = empty_blob;
      Blob raw = empty_blob;
      blob_append(&raw,zBody,-1);
      wiki_convert(&raw,&content,0);
      len = strlen(zBody);
      len = (unsigned int)blob_size(&content);
      cson_object_set(pay,"contentLength",cson_value_new_integer((cson_int_t)len));
      cson_object_set(pay,"content",
                      cson_value_new_string(blob_buffer(&content),len));
      blob_reset(&content);
      blob_reset(&raw);
    }else{
      len = strlen(zBody);
      cson_object_set(pay,"contentLength",cson_value_new_integer((cson_int_t)len));
      cson_object_set(pay,"content",cson_value_new_string(zBody,len));
    }
    /*TODO: add 'T' (tag) fields*/
    /*TODO: add the 'A' card (file attachment) entries?*/
    manifest_destroy(pWiki);
    return payV;
  }







|










|






|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    unsigned int len;
    cson_value * payV = cson_value_new_object();
    cson_object * pay = cson_value_get_object(payV);
    cson_object_set(pay,"name",json_new_string(zPageName));
    cson_object_set(pay,"uuid",json_new_string(zUuid));
    free(zUuid);
    zUuid = NULL;
    cson_object_set(pay,"rid",json_new_int((cson_int_t)rid));
    cson_object_set(pay,"lastSavedBy",json_new_string(pWiki->zUser));
    cson_object_set(pay,FossilJsonKeys.timestamp, json_julian_to_timestamp(pWiki->rDate));
    cson_object_set(pay,"contentFormat",json_new_string(zFormat));
    if( ('h'==*zFormat) ){
      Blob content = empty_blob;
      Blob raw = empty_blob;
      blob_append(&raw,zBody,-1);
      wiki_convert(&raw,&content,0);
      len = strlen(zBody);
      len = (unsigned int)blob_size(&content);
      cson_object_set(pay,"contentLength",json_new_int((cson_int_t)len));
      cson_object_set(pay,"content",
                      cson_value_new_string(blob_buffer(&content),len));
      blob_reset(&content);
      blob_reset(&raw);
    }else{
      len = strlen(zBody);
      cson_object_set(pay,"contentLength",json_new_int((cson_int_t)len));
      cson_object_set(pay,"content",cson_value_new_string(zBody,len));
    }
    /*TODO: add 'T' (tag) fields*/
    /*TODO: add the 'A' card (file attachment) entries?*/
    manifest_destroy(pWiki);
    return payV;
  }