diff --git a/src/distroquery.c b/src/distroquery.c
index 4622127..48dab01 100644
--- a/src/distroquery.c
+++ b/src/distroquery.c
@@ -74,35 +74,55 @@
static struct configTag *firstconfigtag = NULL, *configtag = NULL;
char *repository_tag = NULL;
char *query;
+struct configTag *query_repositories[100];
+int search_milestone1 = 0, search_milestone2 = 1, search_devel = 1;
void printInputForm(char *data) {
struct configTag *ct = firstconfigtag;
+ const char ajax_call[] = "ajax_getvalues("
+// "'repository='+getElementById('repository').value"
+ "'query='+getElementById('query').value+"
+ "'&search_devel='+getElementById('search_devel').checked+"
+ "'&search_milestone2='+getElementById('search_milestone2').checked+"
+ "'&search_milestone1='+getElementById('search_milestone1').checked"
+ ")";
+
printf("");
- printf("");
- printf(" Repository: ");
}
-
void printQueryData(char* repository_tag, char* query) {
- int i;
+ int i, numresults = 0;
+ char dbname[PATH_MAX];
+ sqlite3_stmt *statement;
+ char sql[PATH_MAX];
+ int j;
- configtag = findRepositoryByTag(repository_tag);
+/* configtag = findRepositoryByTag(repository_tag);
if (!configtag) {
fprintf(stderr, "Fatal error: configuration missing for given tag\n");
exit(1);
}
- char dbname[PATH_MAX];
-
for (i = 0; i <= configtag->repository_level; i++) {
snprintf(dbname, PATH_MAX, "%sdistromatic.db", configtag->repository[i]->repository_dir);
if (sqlite3_open_v2(dbname, (sqlite3**)&configtag->repository[i]->db, SQLITE_OPEN_READONLY, NULL)) {
@@ -110,26 +130,33 @@ void printQueryData(char* repository_tag, char* query) {
configtag->repository[i]->db = NULL;
fprintf(stderr, "ERROR: unable to open sqlite3 db %s; aborting.\n", dbname);
}
+ }*/
+
+ printf("repository_dir);
+ if (sqlite3_open_v2(dbname, (sqlite3**)&query_repositories[i]->db, SQLITE_OPEN_READONLY, NULL)) {
+ if (query_repositories[i]->db) sqlite3_close(query_repositories[i]->db);
+ query_repositories[i]->db = NULL;
+ fprintf(stderr, "ERROR: unable to open sqlite3 db %s; aborting.\n", dbname);
+ }
}
-
- sqlite3_stmt *statement;
- char sql[PATH_MAX];
- int j;
-
- printf("arch[a]; a++) {
- snprintf(sql, PATH_MAX, "SELECT * FROM packages_%s WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", configtag->arch[a], query, query, query);
- for (i = 0; i <= configtag->repository_level; i++) {
- if (configtag->repository[i]->db &&
- (sqlite3_prepare_v2((sqlite3*)configtag->repository[i]->db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
+
+ int a;
+ for (i = 0; query_repositories[i] != NULL; i++) {
+ for (a = 0; a < ARCHS_MAX && query_repositories[i]->arch[a]; a++) {
+ snprintf(sql, PATH_MAX, "SELECT * FROM packages_%s WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", query_repositories[i]->arch[a], query, query, query);
+ if (query_repositories[i]->db &&
+ (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
while (sqlite3_step(statement) == SQLITE_ROW) {
+ numresults++;
printf("
%s
"
"
%s
"
"%s %s-%s %s Group: %s
"
"
%s
",
- configtag->arch[a],
- configtag->repository[i]->tag,
+ query_repositories[i]->arch[a],
+ query_repositories[i]->tag,
sqlite3_column_text(statement,1),
sqlite3_column_text(statement,4),
sqlite3_column_text(statement,5),
@@ -142,11 +169,12 @@ void printQueryData(char* repository_tag, char* query) {
}
}
- snprintf(sql, PATH_MAX, "SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", query, query, query);
+/* snprintf(sql, PATH_MAX, "SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", query, query, query);
for (i = 0; i <= configtag->repository_level; i++) {
if (configtag->repository[i]->db &&
(sqlite3_prepare_v2((sqlite3*)configtag->repository[i]->db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
while (sqlite3_step(statement) == SQLITE_ROW) {
+ numresults++;
printf("