change commas to OR

This commit is contained in:
Andrew Pamment 2017-10-19 13:03:52 +10:00
parent 6b4cf60c7b
commit 0adf41dff9

View File

@ -1103,25 +1103,25 @@ void file_search() {
if (stype == 0) { if (stype == 0) {
snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND filename MATCH(?"); snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND filename MATCH(?");
for (i=1; i < searchterm_count; i++) { for (i=1; i < searchterm_count; i++) {
strncat(sqlbuffer, ",?", 1024); strncat(sqlbuffer, " OR ?", 1024);
} }
strncat(sqlbuffer, ")", 1024); strncat(sqlbuffer, ")", 1024);
} }
if (stype == 1) { if (stype == 1) {
snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND description MATCH(?"); snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND description MATCH(?");
for (i=1; i < searchterm_count; i++) { for (i=1; i < searchterm_count; i++) {
strncat(sqlbuffer, ",?", 1024); strncat(sqlbuffer, " OR ?", 1024);
} }
strncat(sqlbuffer, ")", 1024); strncat(sqlbuffer, ")", 1024);
} }
if (stype == 2) { if (stype == 2) {
snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND (filename MATCH(?"); snprintf(sqlbuffer, 1024, "select filename, description, size, dlcount, uploaddate from files where approved=1 AND (filename MATCH(?");
for (i=1; i < searchterm_count; i++) { for (i=1; i < searchterm_count; i++) {
strncat(sqlbuffer, ",?", 1024); strncat(sqlbuffer, " OR ?", 1024);
} }
strncat(sqlbuffer, ") OR description MATCH(", 1024); strncat(sqlbuffer, ") OR description MATCH(", 1024);
for (i=1; i < searchterm_count; i++) { for (i=1; i < searchterm_count; i++) {
strncat(sqlbuffer, ",?", 1024); strncat(sqlbuffer, " OR ?", 1024);
} }
strncat(sqlbuffer, "))", 1024); strncat(sqlbuffer, "))", 1024);
} }