aboutsummaryrefslogtreecommitdiff
path: root/src/mysql
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-10-12 16:41:39 +0000
committerGabor X Toth <*@tg-x.net>2016-10-12 16:41:39 +0000
commit7dc9da1f79ef3a619df7c17fab139ad6c7b745bc (patch)
tree1aba9a9fab2d995f418a10c252b10a43bd55c55c /src/mysql
parent2933563516ce9c33c59a9b50734386c64600c2ac (diff)
downloadgnunet-7dc9da1f79ef3a619df7c17fab139ad6c7b745bc.tar.gz
gnunet-7dc9da1f79ef3a619df7c17fab139ad6c7b745bc.zip
mysql: statement_prepare: log query on error
Diffstat (limited to 'src/mysql')
-rw-r--r--src/mysql/mysql.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mysql/mysql.c b/src/mysql/mysql.c
index bebbfbe0f..157ce5275 100644
--- a/src/mysql/mysql.c
+++ b/src/mysql/mysql.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 This file is part of GNUnet 3 This file is part of GNUnet
3 Copyright (C) 2012 GNUnet e.V. 4 Copyright (C) 2012 GNUnet e.V.
@@ -38,7 +39,7 @@
38 * a failure of the command 'cmd' with the message given 39 * a failure of the command 'cmd' with the message given
39 * by strerror(errno). 40 * by strerror(errno).
40 */ 41 */
41#define DIE_MYSQL(cmd, dbh) do { GNUNET_log_from (GNUNET_ERROR_TYPE__ERROR, "mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, mysql_error((dbh)->dbf)); GNUNET_assert (0); } while(0); 42#define DIE_MYSQL(cmd, dbh) do { GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, mysql_error((dbh)->dbf)); GNUNET_assert (0); } while(0);
42 43
43/** 44/**
44 * Log an error message at log-level 'level' that indicates 45 * Log an error message at log-level 'level' that indicates
@@ -431,6 +432,8 @@ prepare_statement (struct GNUNET_MYSQL_StatementHandle *sh)
431 } 432 }
432 if (0 != mysql_stmt_prepare (sh->statement, sh->query, strlen (sh->query))) 433 if (0 != mysql_stmt_prepare (sh->statement, sh->query, strlen (sh->query)))
433 { 434 {
435 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql",
436 "prepare_statement: %s\n", sh->query);
434 LOG_MYSQL (GNUNET_ERROR_TYPE_ERROR, "mysql_stmt_prepare", mc); 437 LOG_MYSQL (GNUNET_ERROR_TYPE_ERROR, "mysql_stmt_prepare", mc);
435 mysql_stmt_close (sh->statement); 438 mysql_stmt_close (sh->statement);
436 sh->statement = NULL; 439 sh->statement = NULL;