Fossil SCM
removed old rptshowJson().
Commit
5b131851006f6d9e28a3642b9bf1b76345b030db
Parent
525816e6d731d4b…
1 file changed
-71
-71
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -1140,76 +1140,5 @@ | ||
| 1140 | 1140 | if( zFilter ){ |
| 1141 | 1141 | free(zSql); |
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - | |
| 1146 | -void rptshowJson( | |
| 1147 | - const char *zRep, | |
| 1148 | - char const * zLimit, | |
| 1149 | - const char *zFilter, | |
| 1150 | - char indention | |
| 1151 | -){ | |
| 1152 | - Stmt q; | |
| 1153 | - char *zSql; | |
| 1154 | - char const *zTitle; | |
| 1155 | - char const *zOwner; | |
| 1156 | - char *zClrKey; | |
| 1157 | - char *zErr1 = 0; | |
| 1158 | - int count = 0; | |
| 1159 | - int rn; | |
| 1160 | - int rc; | |
| 1161 | - cson_value * zJVal = NULL; | |
| 1162 | - | |
| 1163 | - if (!zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ | |
| 1164 | - zTitle = zFullTicketRptTitle; | |
| 1165 | - zSql = mprintf("SELECT * FROM ticket"); | |
| 1166 | - zOwner = g.zLogin; | |
| 1167 | - zClrKey = ""; | |
| 1168 | - }else{ | |
| 1169 | - rn = atoi(zRep); | |
| 1170 | - if( rn ){ | |
| 1171 | - db_prepare(&q, | |
| 1172 | - "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); | |
| 1173 | - }else{ | |
| 1174 | - db_prepare(&q, | |
| 1175 | - "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title=%Q", zRep); | |
| 1176 | - } | |
| 1177 | - if( db_step(&q)!=SQLITE_ROW ){ | |
| 1178 | - db_finalize(&q); | |
| 1179 | - rpt_list_reports(); | |
| 1180 | - fossil_fatal("unkown report format(%s)!",zRep); | |
| 1181 | - } | |
| 1182 | - zTitle = db_column_malloc(&q, 0)/*leak!*/; | |
| 1183 | - zSql = db_column_malloc(&q, 1); | |
| 1184 | - zOwner = db_column_malloc(&q, 2)/*leak!*/; | |
| 1185 | - zClrKey = db_column_malloc(&q, 3); | |
| 1186 | - db_finalize(&q); | |
| 1187 | - } | |
| 1188 | - if( zFilter ){ | |
| 1189 | - char * old = zSql; | |
| 1190 | - zSql = mprintf("SELECT * FROM (%s) WHERE %s%s%s",old,zFilter, | |
| 1191 | - (zLimit?" LIMIT ":""), (zLimit?zLimit:"")); | |
| 1192 | - free(old); | |
| 1193 | - }else if( zLimit ){ | |
| 1194 | - char * old = zSql; | |
| 1195 | - zSql = mprintf("%s LIMIT %s",old, zLimit); | |
| 1196 | - free(old); | |
| 1197 | - } | |
| 1198 | - count = 0; | |
| 1199 | - /*fprintf(stderr,"SQL=[%s]\n",zSql);*/ | |
| 1200 | - sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1); | |
| 1201 | - rc = cson_sqlite3_sql_to_json(g.db, &zJVal, zSql, 1); | |
| 1202 | - if( 0 == rc ){ | |
| 1203 | - cson_output_opt outOpt = cson_output_opt_empty; | |
| 1204 | - outOpt.addNewline = 1; | |
| 1205 | - outOpt.indentation = indention; | |
| 1206 | - rc = cson_output_FILE( zJVal, stdout, &outOpt ); | |
| 1207 | - } else{ | |
| 1208 | - fossil_fatal("sql-to-json failed with code %d (%s)!", rc, | |
| 1209 | - cson_rc_string(rc)); | |
| 1210 | - } | |
| 1211 | - sqlite3_set_authorizer(g.db, 0, 0); | |
| 1212 | - cson_value_free(zJVal); | |
| 1213 | - free(zSql); | |
| 1214 | - free(zClrKey); | |
| 1215 | -} | |
| 1216 | 1145 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1140,76 +1140,5 @@ | |
| 1140 | if( zFilter ){ |
| 1141 | free(zSql); |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | |
| 1146 | void rptshowJson( |
| 1147 | const char *zRep, |
| 1148 | char const * zLimit, |
| 1149 | const char *zFilter, |
| 1150 | char indention |
| 1151 | ){ |
| 1152 | Stmt q; |
| 1153 | char *zSql; |
| 1154 | char const *zTitle; |
| 1155 | char const *zOwner; |
| 1156 | char *zClrKey; |
| 1157 | char *zErr1 = 0; |
| 1158 | int count = 0; |
| 1159 | int rn; |
| 1160 | int rc; |
| 1161 | cson_value * zJVal = NULL; |
| 1162 | |
| 1163 | if (!zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ |
| 1164 | zTitle = zFullTicketRptTitle; |
| 1165 | zSql = mprintf("SELECT * FROM ticket"); |
| 1166 | zOwner = g.zLogin; |
| 1167 | zClrKey = ""; |
| 1168 | }else{ |
| 1169 | rn = atoi(zRep); |
| 1170 | if( rn ){ |
| 1171 | db_prepare(&q, |
| 1172 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); |
| 1173 | }else{ |
| 1174 | db_prepare(&q, |
| 1175 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title=%Q", zRep); |
| 1176 | } |
| 1177 | if( db_step(&q)!=SQLITE_ROW ){ |
| 1178 | db_finalize(&q); |
| 1179 | rpt_list_reports(); |
| 1180 | fossil_fatal("unkown report format(%s)!",zRep); |
| 1181 | } |
| 1182 | zTitle = db_column_malloc(&q, 0)/*leak!*/; |
| 1183 | zSql = db_column_malloc(&q, 1); |
| 1184 | zOwner = db_column_malloc(&q, 2)/*leak!*/; |
| 1185 | zClrKey = db_column_malloc(&q, 3); |
| 1186 | db_finalize(&q); |
| 1187 | } |
| 1188 | if( zFilter ){ |
| 1189 | char * old = zSql; |
| 1190 | zSql = mprintf("SELECT * FROM (%s) WHERE %s%s%s",old,zFilter, |
| 1191 | (zLimit?" LIMIT ":""), (zLimit?zLimit:"")); |
| 1192 | free(old); |
| 1193 | }else if( zLimit ){ |
| 1194 | char * old = zSql; |
| 1195 | zSql = mprintf("%s LIMIT %s",old, zLimit); |
| 1196 | free(old); |
| 1197 | } |
| 1198 | count = 0; |
| 1199 | /*fprintf(stderr,"SQL=[%s]\n",zSql);*/ |
| 1200 | sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1); |
| 1201 | rc = cson_sqlite3_sql_to_json(g.db, &zJVal, zSql, 1); |
| 1202 | if( 0 == rc ){ |
| 1203 | cson_output_opt outOpt = cson_output_opt_empty; |
| 1204 | outOpt.addNewline = 1; |
| 1205 | outOpt.indentation = indention; |
| 1206 | rc = cson_output_FILE( zJVal, stdout, &outOpt ); |
| 1207 | } else{ |
| 1208 | fossil_fatal("sql-to-json failed with code %d (%s)!", rc, |
| 1209 | cson_rc_string(rc)); |
| 1210 | } |
| 1211 | sqlite3_set_authorizer(g.db, 0, 0); |
| 1212 | cson_value_free(zJVal); |
| 1213 | free(zSql); |
| 1214 | free(zClrKey); |
| 1215 | } |
| 1216 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1140,76 +1140,5 @@ | |
| 1140 | if( zFilter ){ |
| 1141 | free(zSql); |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 |