From: Miloš Mulač Date: Tue, 4 Nov 2008 11:58:05 +0000 (+0000) Subject: added test on new column 'flags' in notif_registrations table; X-Git-Tag: test_tag~89 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=dfa81e591b8f4ac9cda436ace9cd2221fff55e65;p=jra1mw.git added test on new column 'flags' in notif_registrations table; --- diff --git a/org.glite.lb.server/src/openserver.c b/org.glite.lb.server/src/openserver.c index b816a38..5a76b6a 100644 --- a/org.glite.lb.server/src/openserver.c +++ b/org.glite.lb.server/src/openserver.c @@ -47,7 +47,17 @@ edg_wll_ErrorCode edg_wll_Open(edg_wll_Context ctx, char *cs) } if (ret < 0) goto err; glite_lbu_FreeStmt(&stmt); - if (hit != 5) { + // new columns added to notif_registrations + if (glite_lbu_ExecSQL(ctx->dbctx, "DESC notif_registrations", &stmt) <= 0) goto err; + while (hit < 6 && (ret = glite_lbu_FetchRow(stmt, 1, NULL, cols)) > 0) { + assert(ret <= (int)(sizeof cols/sizeof cols[0])); + if (strcasecmp(cols[0], "flags") == 0) hit++; + for (i = 0; i < ret; i++) free(cols[i]); + } + if (ret < 0) goto err; + glite_lbu_FreeStmt(&stmt); + + if (hit != 6) { ret = edg_wll_SetError(ctx, EDG_WLL_ERROR_DB_INIT, "old DB schema found, migration to new schema needed"); goto close_db; }