From 008a1eb67591b1a90587f95f33abc0a5ec8eaa8b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Thu, 13 Dec 2007 11:48:45 +0000 Subject: [PATCH] Fixed MYSQL_OPT_RECONNECT option. --- org.glite.jp.primary/src/mysql.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.glite.jp.primary/src/mysql.c b/org.glite.jp.primary/src/mysql.c index 82e5747..fe45558 100644 --- a/org.glite.jp.primary/src/mysql.c +++ b/org.glite.jp.primary/src/mysql.c @@ -58,9 +58,10 @@ int glite_jp_db_connect(glite_jp_context_t ctx,char *cs) } mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my"); -#ifdef MYSQL_OPT_RECONNECT - mysql_options(ctx->dbhandle, MYSQL_OPT_RECONNECT, &reconnect); -#endif + if (MYSQL_VERSION_ID >= 50013){ + mysql_options(ctx->dbhandle, MYSQL_OPT_RECONNECT, &reconnect); + printf("Set MYSQL_OPT_RECONNECT\n"); + } host = user = pw = db = NULL; @@ -124,6 +125,7 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st err.code = EEXIST; err.desc = mysql_error((MYSQL *) ctx->dbhandle); glite_jp_stack_error(ctx,&err); + printf("glite_jp_db_execstmt return from 127, ctx->error = %i\n", ctx->error); return -1; break; case CR_SERVER_GONE_ERROR: @@ -133,6 +135,7 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st break; default: my_err(ctx, __FUNCTION__); + printf("glite_jp_db_execstmt return from 137, ctx->error = %i\n", ctx->error); return -1; break; } @@ -145,6 +148,7 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st if (!*stmt) { err.code = ENOMEM; glite_jp_stack_error(ctx,&err); + printf("glite_jp_db_execstmt return from 150, ctx->error = %i\n", ctx->error); return -1; } memset(*stmt,0,sizeof(**stmt)); @@ -153,6 +157,7 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st if (!(**stmt).result) { if (mysql_errno((MYSQL *) ctx->dbhandle)) { my_err(ctx, __FUNCTION__); + printf("glite_jp_db_execstmt return from 159, ctx->error = %i\n", ctx->error); return -1; } } @@ -161,6 +166,7 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st mysql_free_result(r); } + printf("glite_jp_db_execstmt return from 168, ctx->error = %i\n", ctx->error); return mysql_affected_rows((MYSQL *) ctx->dbhandle); } -- 1.8.2.3