From 66a8f60d9d1ced70fe46d6e76041989e7b779f0f Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 4 May 2021 05:37:02 +0200 Subject: [PATCH] Print the sphinx query to stdout in dry run Signed-off-by: Janos SUTO --- src/pilerexport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pilerexport.c b/src/pilerexport.c index a1f77189..8eca2b05 100644 --- a/src/pilerexport.c +++ b/src/pilerexport.c @@ -163,7 +163,7 @@ int append_string_to_buffer(char **buffer, char *str){ uint64 run_query(struct session_data *sdata, struct session_data *sdata2, char *where_condition, uint64 last_id, int *num, struct config *cfg){ MYSQL_ROW row; uint64 id=0; - char s[SMALLBUFSIZE]; + char s[MAXBUFSIZE]; int rc=0; *num = 0; @@ -175,6 +175,10 @@ uint64 run_query(struct session_data *sdata, struct session_data *sdata2, char * snprintf(s, sizeof(s)-1, "SELECT id FROM %s WHERE %s AND id > %llu ORDER BY id ASC LIMIT 0,%d", index_list, where_condition, last_id, max_matches); + if(dryrun){ + printf("sphinx query: %s\n", s); + } + syslog(LOG_PRIORITY, "sphinx query: %s", s); if(mysql_real_query(&(sdata2->mysql), s, strlen(s)) == 0){