Fossil SCM
Renamed /json/artifact/?uuid=xxx to name=xxx (it now matches the docs), minor internal cleanups in /json/artifact.
Commit
d2c5b943f3d7ed23bd9608f2eee8a4714a745530
Parent
6420654c806b93b…
2 files changed
+18
-1
+24
-41
+18
-1
| --- ajax/i-test/rhino-test.js | ||
| +++ ajax/i-test/rhino-test.js | ||
| @@ -3,11 +3,11 @@ | ||
| 3 | 3 | 'http://localhost:8080' |
| 4 | 4 | //'http://fjson/cgi-bin/fossil-json.cgi' |
| 5 | 5 | //'http://192.168.1.62:8080' |
| 6 | 6 | //'http://fossil.wanderinghorse.net/repos/fossil-json-java/index.cgi' |
| 7 | 7 | , |
| 8 | - verbose:false, | |
| 8 | + verbose:true, | |
| 9 | 9 | fossilBinary:'fossil', |
| 10 | 10 | wiki:{} |
| 11 | 11 | }; |
| 12 | 12 | (function bootstrap() { |
| 13 | 13 | var srcdir = '../js/'; |
| @@ -171,10 +171,26 @@ | ||
| 171 | 171 | print("Got first wiki page: "+WhAjaj.stringify(rs.payload)); |
| 172 | 172 | |
| 173 | 173 | } |
| 174 | 174 | testAnonWiki.description = 'Fetch wiki list as anonymous user.'; |
| 175 | 175 | |
| 176 | +function testFetchCheckinArtifact(){ | |
| 177 | + var art = '18dd383e5e7684ece'; | |
| 178 | + var rs; | |
| 179 | + TestApp.fossil.sendCommand('/json/artifact',{ | |
| 180 | + 'name': art | |
| 181 | + }, | |
| 182 | + { | |
| 183 | + onResponse:function(resp,req){ | |
| 184 | + rs = resp; | |
| 185 | + } | |
| 186 | + }); | |
| 187 | + assertResponseOK(rs); | |
| 188 | + assert(3 == rs.payload.artifact.parents.length, 'Got 3 parent artifacts.'); | |
| 189 | +} | |
| 190 | +testFetchCheckinArtifact.description = '/json/artifact/CHECKIN'; | |
| 191 | + | |
| 176 | 192 | function testAnonLogout(){ |
| 177 | 193 | var rs; |
| 178 | 194 | TestApp.fossil.logout({ |
| 179 | 195 | onResponse:function(resp,req){ |
| 180 | 196 | rs = resp; |
| @@ -239,10 +255,11 @@ | ||
| 239 | 255 | var testList = [ |
| 240 | 256 | testHAI, |
| 241 | 257 | testIAmNobody, |
| 242 | 258 | testAnonymousLogin, |
| 243 | 259 | testAnonWiki, |
| 260 | + testFetchCheckinArtifact, | |
| 244 | 261 | testAnonLogout, |
| 245 | 262 | testExternalProcess, |
| 246 | 263 | testExternalProcessHandler |
| 247 | 264 | ]; |
| 248 | 265 | var i, f; |
| 249 | 266 |
| --- ajax/i-test/rhino-test.js | |
| +++ ajax/i-test/rhino-test.js | |
| @@ -3,11 +3,11 @@ | |
| 3 | 'http://localhost:8080' |
| 4 | //'http://fjson/cgi-bin/fossil-json.cgi' |
| 5 | //'http://192.168.1.62:8080' |
| 6 | //'http://fossil.wanderinghorse.net/repos/fossil-json-java/index.cgi' |
| 7 | , |
| 8 | verbose:false, |
| 9 | fossilBinary:'fossil', |
| 10 | wiki:{} |
| 11 | }; |
| 12 | (function bootstrap() { |
| 13 | var srcdir = '../js/'; |
| @@ -171,10 +171,26 @@ | |
| 171 | print("Got first wiki page: "+WhAjaj.stringify(rs.payload)); |
| 172 | |
| 173 | } |
| 174 | testAnonWiki.description = 'Fetch wiki list as anonymous user.'; |
| 175 | |
| 176 | function testAnonLogout(){ |
| 177 | var rs; |
| 178 | TestApp.fossil.logout({ |
| 179 | onResponse:function(resp,req){ |
| 180 | rs = resp; |
| @@ -239,10 +255,11 @@ | |
| 239 | var testList = [ |
| 240 | testHAI, |
| 241 | testIAmNobody, |
| 242 | testAnonymousLogin, |
| 243 | testAnonWiki, |
| 244 | testAnonLogout, |
| 245 | testExternalProcess, |
| 246 | testExternalProcessHandler |
| 247 | ]; |
| 248 | var i, f; |
| 249 |
| --- ajax/i-test/rhino-test.js | |
| +++ ajax/i-test/rhino-test.js | |
| @@ -3,11 +3,11 @@ | |
| 3 | 'http://localhost:8080' |
| 4 | //'http://fjson/cgi-bin/fossil-json.cgi' |
| 5 | //'http://192.168.1.62:8080' |
| 6 | //'http://fossil.wanderinghorse.net/repos/fossil-json-java/index.cgi' |
| 7 | , |
| 8 | verbose:true, |
| 9 | fossilBinary:'fossil', |
| 10 | wiki:{} |
| 11 | }; |
| 12 | (function bootstrap() { |
| 13 | var srcdir = '../js/'; |
| @@ -171,10 +171,26 @@ | |
| 171 | print("Got first wiki page: "+WhAjaj.stringify(rs.payload)); |
| 172 | |
| 173 | } |
| 174 | testAnonWiki.description = 'Fetch wiki list as anonymous user.'; |
| 175 | |
| 176 | function testFetchCheckinArtifact(){ |
| 177 | var art = '18dd383e5e7684ece'; |
| 178 | var rs; |
| 179 | TestApp.fossil.sendCommand('/json/artifact',{ |
| 180 | 'name': art |
| 181 | }, |
| 182 | { |
| 183 | onResponse:function(resp,req){ |
| 184 | rs = resp; |
| 185 | } |
| 186 | }); |
| 187 | assertResponseOK(rs); |
| 188 | assert(3 == rs.payload.artifact.parents.length, 'Got 3 parent artifacts.'); |
| 189 | } |
| 190 | testFetchCheckinArtifact.description = '/json/artifact/CHECKIN'; |
| 191 | |
| 192 | function testAnonLogout(){ |
| 193 | var rs; |
| 194 | TestApp.fossil.logout({ |
| 195 | onResponse:function(resp,req){ |
| 196 | rs = resp; |
| @@ -239,10 +255,11 @@ | |
| 255 | var testList = [ |
| 256 | testHAI, |
| 257 | testIAmNobody, |
| 258 | testAnonymousLogin, |
| 259 | testAnonWiki, |
| 260 | testFetchCheckinArtifact, |
| 261 | testAnonLogout, |
| 262 | testExternalProcess, |
| 263 | testExternalProcessHandler |
| 264 | ]; |
| 265 | var i, f; |
| 266 |
+24
-41
| --- src/json_artifact.c | ||
| +++ src/json_artifact.c | ||
| @@ -81,47 +81,51 @@ | ||
| 81 | 81 | ** |
| 82 | 82 | ** Returned value is NULL or an Object owned by the caller. |
| 83 | 83 | */ |
| 84 | 84 | cson_value * json_artifact_for_ci( int rid, char showFiles ){ |
| 85 | 85 | cson_value * v = NULL; |
| 86 | - Stmt q; | |
| 86 | + Stmt q = empty_Stmt; | |
| 87 | 87 | static cson_value * eventTypeLabel = NULL; |
| 88 | 88 | if(!eventTypeLabel){ |
| 89 | 89 | eventTypeLabel = json_new_string("checkin"); |
| 90 | 90 | json_gc_add("$EVENT_TYPE_LABEL(commit)", eventTypeLabel); |
| 91 | 91 | } |
| 92 | - | |
| 93 | - db_prepare(&q, | |
| 94 | - "SELECT uuid, " | |
| 95 | - " cast(strftime('%%s',mtime) as int), " | |
| 96 | - " user, " | |
| 97 | - " comment," | |
| 98 | - " strftime('%%s',omtime)" | |
| 99 | - " FROM blob, event" | |
| 100 | - " WHERE blob.rid=%d" | |
| 101 | - " AND event.objid=%d", | |
| 92 | + | |
| 93 | + db_prepare(&q, | |
| 94 | + "SELECT b.uuid, " | |
| 95 | + " cast(strftime('%%s',e.mtime) as int), " | |
| 96 | + " strftime('%%s',e.omtime)," | |
| 97 | + " e.user, " | |
| 98 | + " e.comment" | |
| 99 | + " FROM blob b, event e" | |
| 100 | + " WHERE b.rid=%d" | |
| 101 | + " AND e.objid=%d", | |
| 102 | 102 | rid, rid |
| 103 | 103 | ); |
| 104 | 104 | if( db_step(&q)==SQLITE_ROW ){ |
| 105 | 105 | cson_object * o; |
| 106 | 106 | cson_value * tmpV = NULL; |
| 107 | 107 | const char *zUuid = db_column_text(&q, 0); |
| 108 | 108 | const char *zUser; |
| 109 | 109 | const char *zComment; |
| 110 | 110 | char * zEUser, * zEComment; |
| 111 | -#define ADD_PRIMARY_PARENT_UUID 0 /* temporary local macro */ | |
| 112 | -#if ADD_PRIMARY_PARENT_UUID | |
| 113 | - char * zParent = NULL; | |
| 114 | -#endif | |
| 115 | 111 | int mtime, omtime; |
| 116 | 112 | v = cson_value_new_object(); |
| 117 | 113 | o = cson_value_get_object(v); |
| 118 | 114 | #define SET(K,V) cson_object_set(o,(K), (V)) |
| 119 | 115 | SET("type", eventTypeLabel ); |
| 120 | 116 | SET("uuid",json_new_string(zUuid)); |
| 121 | 117 | SET("isLeaf", cson_value_new_bool(is_a_leaf(rid))); |
| 122 | - zUser = db_column_text(&q,2); | |
| 118 | + | |
| 119 | + mtime = db_column_int(&q,1); | |
| 120 | + SET("mtime",json_new_int(mtime)); | |
| 121 | + omtime = db_column_int(&q,2); | |
| 122 | + if(omtime && (omtime!=mtime)){ | |
| 123 | + SET("originTime",json_new_int(omtime)); | |
| 124 | + } | |
| 125 | + | |
| 126 | + zUser = db_column_text(&q,3); | |
| 123 | 127 | zEUser = db_text(0, |
| 124 | 128 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 125 | 129 | TAG_USER, rid); |
| 126 | 130 | if(zEUser){ |
| 127 | 131 | SET("user", json_new_string(zEUser)); |
| @@ -131,11 +135,11 @@ | ||
| 131 | 135 | free(zEUser); |
| 132 | 136 | }else{ |
| 133 | 137 | SET("user",json_new_string(zUser)); |
| 134 | 138 | } |
| 135 | 139 | |
| 136 | - zComment = db_column_text(&q,3); | |
| 140 | + zComment = db_column_text(&q,4); | |
| 137 | 141 | zEComment = db_text(0, |
| 138 | 142 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 139 | 143 | TAG_COMMENT, rid); |
| 140 | 144 | if(zEComment){ |
| 141 | 145 | SET("comment",json_new_string(zEComment)); |
| @@ -145,31 +149,10 @@ | ||
| 145 | 149 | free(zEComment); |
| 146 | 150 | }else{ |
| 147 | 151 | SET("comment",json_new_string(zComment)); |
| 148 | 152 | } |
| 149 | 153 | |
| 150 | - mtime = db_column_int(&q,1); | |
| 151 | - SET("mtime",json_new_int(mtime)); | |
| 152 | - omtime = db_column_int(&q,4); | |
| 153 | - if(omtime && (omtime!=mtime)){ | |
| 154 | - SET("originTime",json_new_int(omtime)); | |
| 155 | - } | |
| 156 | - | |
| 157 | -#if ADD_PRIMARY_PARENT_UUID | |
| 158 | - zParent = db_text(0, | |
| 159 | - "SELECT uuid FROM plink, blob" | |
| 160 | - " WHERE plink.cid=%d AND blob.rid=plink.pid" | |
| 161 | - " AND plink.isprim", | |
| 162 | - rid | |
| 163 | - ); | |
| 164 | - tmpV = zParent ? json_new_string(zParent) : cson_value_null(); | |
| 165 | - free(zParent); | |
| 166 | - zParent = NULL; | |
| 167 | - SET("parentUuid", tmpV ); | |
| 168 | -#endif | |
| 169 | -#undef ADD_PRIMARY_PARENT_UUID | |
| 170 | - | |
| 171 | 154 | tmpV = json_parent_uuids_for_ci(rid); |
| 172 | 155 | if(tmpV){ |
| 173 | 156 | SET("parents", tmpV); |
| 174 | 157 | } |
| 175 | 158 | |
| @@ -223,11 +206,11 @@ | ||
| 223 | 206 | |
| 224 | 207 | /* |
| 225 | 208 | ** Sub-impl of /json/artifact for checkins. |
| 226 | 209 | */ |
| 227 | 210 | static cson_value * json_artifact_ci( int rid ){ |
| 228 | - if(! g.perm.Read ){ | |
| 211 | + if(! g.perm.History ){ | |
| 229 | 212 | g.json.resultCode = FSL_JSON_E_DENIED; |
| 230 | 213 | return NULL; |
| 231 | 214 | }else{ |
| 232 | 215 | return json_artifact_for_ci(rid, 1); |
| 233 | 216 | } |
| @@ -331,14 +314,14 @@ | ||
| 331 | 314 | cson_value * entry = NULL; |
| 332 | 315 | Blob uuid = empty_blob; |
| 333 | 316 | int rc; |
| 334 | 317 | int rid = 0; |
| 335 | 318 | ArtifactDispatchEntry const * dispatcher = &ArtifactDispatchList[0]; |
| 336 | - zName = json_find_option_cstr2("uuid", NULL, NULL, 2); | |
| 319 | + zName = json_find_option_cstr2("name", NULL, NULL, 2); | |
| 337 | 320 | if(!zName || !*zName) { |
| 338 | 321 | json_set_err(FSL_JSON_E_MISSING_ARGS, |
| 339 | - "Missing 'uuid' argument."); | |
| 322 | + "Missing 'name' argument."); | |
| 340 | 323 | return NULL; |
| 341 | 324 | } |
| 342 | 325 | |
| 343 | 326 | if( validate16(zName, strlen(zName)) ){ |
| 344 | 327 | if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){ |
| 345 | 328 |
| --- src/json_artifact.c | |
| +++ src/json_artifact.c | |
| @@ -81,47 +81,51 @@ | |
| 81 | ** |
| 82 | ** Returned value is NULL or an Object owned by the caller. |
| 83 | */ |
| 84 | cson_value * json_artifact_for_ci( int rid, char showFiles ){ |
| 85 | cson_value * v = NULL; |
| 86 | Stmt q; |
| 87 | static cson_value * eventTypeLabel = NULL; |
| 88 | if(!eventTypeLabel){ |
| 89 | eventTypeLabel = json_new_string("checkin"); |
| 90 | json_gc_add("$EVENT_TYPE_LABEL(commit)", eventTypeLabel); |
| 91 | } |
| 92 | |
| 93 | db_prepare(&q, |
| 94 | "SELECT uuid, " |
| 95 | " cast(strftime('%%s',mtime) as int), " |
| 96 | " user, " |
| 97 | " comment," |
| 98 | " strftime('%%s',omtime)" |
| 99 | " FROM blob, event" |
| 100 | " WHERE blob.rid=%d" |
| 101 | " AND event.objid=%d", |
| 102 | rid, rid |
| 103 | ); |
| 104 | if( db_step(&q)==SQLITE_ROW ){ |
| 105 | cson_object * o; |
| 106 | cson_value * tmpV = NULL; |
| 107 | const char *zUuid = db_column_text(&q, 0); |
| 108 | const char *zUser; |
| 109 | const char *zComment; |
| 110 | char * zEUser, * zEComment; |
| 111 | #define ADD_PRIMARY_PARENT_UUID 0 /* temporary local macro */ |
| 112 | #if ADD_PRIMARY_PARENT_UUID |
| 113 | char * zParent = NULL; |
| 114 | #endif |
| 115 | int mtime, omtime; |
| 116 | v = cson_value_new_object(); |
| 117 | o = cson_value_get_object(v); |
| 118 | #define SET(K,V) cson_object_set(o,(K), (V)) |
| 119 | SET("type", eventTypeLabel ); |
| 120 | SET("uuid",json_new_string(zUuid)); |
| 121 | SET("isLeaf", cson_value_new_bool(is_a_leaf(rid))); |
| 122 | zUser = db_column_text(&q,2); |
| 123 | zEUser = db_text(0, |
| 124 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 125 | TAG_USER, rid); |
| 126 | if(zEUser){ |
| 127 | SET("user", json_new_string(zEUser)); |
| @@ -131,11 +135,11 @@ | |
| 131 | free(zEUser); |
| 132 | }else{ |
| 133 | SET("user",json_new_string(zUser)); |
| 134 | } |
| 135 | |
| 136 | zComment = db_column_text(&q,3); |
| 137 | zEComment = db_text(0, |
| 138 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 139 | TAG_COMMENT, rid); |
| 140 | if(zEComment){ |
| 141 | SET("comment",json_new_string(zEComment)); |
| @@ -145,31 +149,10 @@ | |
| 145 | free(zEComment); |
| 146 | }else{ |
| 147 | SET("comment",json_new_string(zComment)); |
| 148 | } |
| 149 | |
| 150 | mtime = db_column_int(&q,1); |
| 151 | SET("mtime",json_new_int(mtime)); |
| 152 | omtime = db_column_int(&q,4); |
| 153 | if(omtime && (omtime!=mtime)){ |
| 154 | SET("originTime",json_new_int(omtime)); |
| 155 | } |
| 156 | |
| 157 | #if ADD_PRIMARY_PARENT_UUID |
| 158 | zParent = db_text(0, |
| 159 | "SELECT uuid FROM plink, blob" |
| 160 | " WHERE plink.cid=%d AND blob.rid=plink.pid" |
| 161 | " AND plink.isprim", |
| 162 | rid |
| 163 | ); |
| 164 | tmpV = zParent ? json_new_string(zParent) : cson_value_null(); |
| 165 | free(zParent); |
| 166 | zParent = NULL; |
| 167 | SET("parentUuid", tmpV ); |
| 168 | #endif |
| 169 | #undef ADD_PRIMARY_PARENT_UUID |
| 170 | |
| 171 | tmpV = json_parent_uuids_for_ci(rid); |
| 172 | if(tmpV){ |
| 173 | SET("parents", tmpV); |
| 174 | } |
| 175 | |
| @@ -223,11 +206,11 @@ | |
| 223 | |
| 224 | /* |
| 225 | ** Sub-impl of /json/artifact for checkins. |
| 226 | */ |
| 227 | static cson_value * json_artifact_ci( int rid ){ |
| 228 | if(! g.perm.Read ){ |
| 229 | g.json.resultCode = FSL_JSON_E_DENIED; |
| 230 | return NULL; |
| 231 | }else{ |
| 232 | return json_artifact_for_ci(rid, 1); |
| 233 | } |
| @@ -331,14 +314,14 @@ | |
| 331 | cson_value * entry = NULL; |
| 332 | Blob uuid = empty_blob; |
| 333 | int rc; |
| 334 | int rid = 0; |
| 335 | ArtifactDispatchEntry const * dispatcher = &ArtifactDispatchList[0]; |
| 336 | zName = json_find_option_cstr2("uuid", NULL, NULL, 2); |
| 337 | if(!zName || !*zName) { |
| 338 | json_set_err(FSL_JSON_E_MISSING_ARGS, |
| 339 | "Missing 'uuid' argument."); |
| 340 | return NULL; |
| 341 | } |
| 342 | |
| 343 | if( validate16(zName, strlen(zName)) ){ |
| 344 | if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){ |
| 345 |
| --- src/json_artifact.c | |
| +++ src/json_artifact.c | |
| @@ -81,47 +81,51 @@ | |
| 81 | ** |
| 82 | ** Returned value is NULL or an Object owned by the caller. |
| 83 | */ |
| 84 | cson_value * json_artifact_for_ci( int rid, char showFiles ){ |
| 85 | cson_value * v = NULL; |
| 86 | Stmt q = empty_Stmt; |
| 87 | static cson_value * eventTypeLabel = NULL; |
| 88 | if(!eventTypeLabel){ |
| 89 | eventTypeLabel = json_new_string("checkin"); |
| 90 | json_gc_add("$EVENT_TYPE_LABEL(commit)", eventTypeLabel); |
| 91 | } |
| 92 | |
| 93 | db_prepare(&q, |
| 94 | "SELECT b.uuid, " |
| 95 | " cast(strftime('%%s',e.mtime) as int), " |
| 96 | " strftime('%%s',e.omtime)," |
| 97 | " e.user, " |
| 98 | " e.comment" |
| 99 | " FROM blob b, event e" |
| 100 | " WHERE b.rid=%d" |
| 101 | " AND e.objid=%d", |
| 102 | rid, rid |
| 103 | ); |
| 104 | if( db_step(&q)==SQLITE_ROW ){ |
| 105 | cson_object * o; |
| 106 | cson_value * tmpV = NULL; |
| 107 | const char *zUuid = db_column_text(&q, 0); |
| 108 | const char *zUser; |
| 109 | const char *zComment; |
| 110 | char * zEUser, * zEComment; |
| 111 | int mtime, omtime; |
| 112 | v = cson_value_new_object(); |
| 113 | o = cson_value_get_object(v); |
| 114 | #define SET(K,V) cson_object_set(o,(K), (V)) |
| 115 | SET("type", eventTypeLabel ); |
| 116 | SET("uuid",json_new_string(zUuid)); |
| 117 | SET("isLeaf", cson_value_new_bool(is_a_leaf(rid))); |
| 118 | |
| 119 | mtime = db_column_int(&q,1); |
| 120 | SET("mtime",json_new_int(mtime)); |
| 121 | omtime = db_column_int(&q,2); |
| 122 | if(omtime && (omtime!=mtime)){ |
| 123 | SET("originTime",json_new_int(omtime)); |
| 124 | } |
| 125 | |
| 126 | zUser = db_column_text(&q,3); |
| 127 | zEUser = db_text(0, |
| 128 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 129 | TAG_USER, rid); |
| 130 | if(zEUser){ |
| 131 | SET("user", json_new_string(zEUser)); |
| @@ -131,11 +135,11 @@ | |
| 135 | free(zEUser); |
| 136 | }else{ |
| 137 | SET("user",json_new_string(zUser)); |
| 138 | } |
| 139 | |
| 140 | zComment = db_column_text(&q,4); |
| 141 | zEComment = db_text(0, |
| 142 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 143 | TAG_COMMENT, rid); |
| 144 | if(zEComment){ |
| 145 | SET("comment",json_new_string(zEComment)); |
| @@ -145,31 +149,10 @@ | |
| 149 | free(zEComment); |
| 150 | }else{ |
| 151 | SET("comment",json_new_string(zComment)); |
| 152 | } |
| 153 | |
| 154 | tmpV = json_parent_uuids_for_ci(rid); |
| 155 | if(tmpV){ |
| 156 | SET("parents", tmpV); |
| 157 | } |
| 158 | |
| @@ -223,11 +206,11 @@ | |
| 206 | |
| 207 | /* |
| 208 | ** Sub-impl of /json/artifact for checkins. |
| 209 | */ |
| 210 | static cson_value * json_artifact_ci( int rid ){ |
| 211 | if(! g.perm.History ){ |
| 212 | g.json.resultCode = FSL_JSON_E_DENIED; |
| 213 | return NULL; |
| 214 | }else{ |
| 215 | return json_artifact_for_ci(rid, 1); |
| 216 | } |
| @@ -331,14 +314,14 @@ | |
| 314 | cson_value * entry = NULL; |
| 315 | Blob uuid = empty_blob; |
| 316 | int rc; |
| 317 | int rid = 0; |
| 318 | ArtifactDispatchEntry const * dispatcher = &ArtifactDispatchList[0]; |
| 319 | zName = json_find_option_cstr2("name", NULL, NULL, 2); |
| 320 | if(!zName || !*zName) { |
| 321 | json_set_err(FSL_JSON_E_MISSING_ARGS, |
| 322 | "Missing 'name' argument."); |
| 323 | return NULL; |
| 324 | } |
| 325 | |
| 326 | if( validate16(zName, strlen(zName)) ){ |
| 327 | if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){ |
| 328 |