From d7d104596d2bed6e2d54f6bbb12ee3302bb49067 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 14 Aug 2007 17:01:04 +0000 Subject: [PATCH] Proper fix for the MySQL keyword problem. DB structure remains the same as in previous versions. --- .../config/glite-jp-index-dbsetup.sql | 60 +++++++++++----------- org.glite.jp.index/examples/query-tests/dump1.sql | 2 +- org.glite.jp.index/src/db_ops.c | 10 ++-- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/org.glite.jp.index/config/glite-jp-index-dbsetup.sql b/org.glite.jp.index/config/glite-jp-index-dbsetup.sql index e0f7f88..97a5a2f 100644 --- a/org.glite.jp.index/config/glite-jp-index-dbsetup.sql +++ b/org.glite.jp.index/config/glite-jp-index-dbsetup.sql @@ -1,35 +1,35 @@ create table jobs ( - jobid char(32) binary not null, - dg_jobid varchar(255) binary not null, - ownerid char(32) binary not null, - aclid char(32) binary null, - ps varchar(255) not null, + `jobid` char(32) binary not null, + `dg_jobid` varchar(255) binary not null, + `ownerid` char(32) binary not null, + `aclid` char(32) binary null, + `ps` varchar(255) not null, - primary key (jobid), - unique (dg_jobid), - index (jobid), + primary key (jobid), + unique (dg_jobid), + index (jobid), index (dg_jobid) ); create table attrs ( - attrid char(32) binary not null, - name varchar(255) binary not null, - indexed int not null, - type char(32) binary null, + `attrid` char(32) binary not null, + `name` varchar(255) binary not null, + `indexed` int not null, + `type` char(32) binary null, - primary key (attrid), - index (attrid), + primary key (attrid), + index (attrid), index (name) ); create table feeds ( - uniqueid int auto_increment not null, - feedid char(32) binary unique, - state int not null, - locked int not null, - source varchar(255) not null, - expires datetime, - conditions mediumblob null, + `uniqueid` int auto_increment not null, + `feedid` char(32) binary unique, + `state` int not null, + `locked` int not null, + `source` varchar(255) not null, + `expires` datetime, + `condition` mediumblob null, primary key (uniqueid), index (uniqueid), @@ -38,16 +38,16 @@ create table feeds ( ); create table acls ( - aclid char(32) binary not null, - value mediumblob not null, - refcnt int not null, + `aclid` char(32) binary not null, + `value` mediumblob not null, + `refcnt` int not null, primary key (aclid) ); create table users ( - userid char(32) binary not null, - cert_subj varchar(255) binary not null, + `userid` char(32) binary not null, + `cert_subj` varchar(255) binary not null, primary key (userid), unique (cert_subj) @@ -58,10 +58,10 @@ create table users ( # value is created only for attributes configured to be indexed # #create table attr_ ( -# jobid char(32) binary not null, -# value varchar(255) binary not null, -# full_value mediumblob not null, -# origin int not null, +# `jobid` char(32) binary not null, +# `value` varchar(255) binary not null, +# `full_value` mediumblob not null, +# `origin` int not null, # # index (jobid), # index (value) diff --git a/org.glite.jp.index/examples/query-tests/dump1.sql b/org.glite.jp.index/examples/query-tests/dump1.sql index ef17d40..1953b66 100644 --- a/org.glite.jp.index/examples/query-tests/dump1.sql +++ b/org.glite.jp.index/examples/query-tests/dump1.sql @@ -515,7 +515,7 @@ CREATE TABLE `feeds` ( `locked` int(11) NOT NULL default '0', `source` varchar(255) NOT NULL default '', `expires` datetime default NULL, - `conditions` mediumblob, + `condition` mediumblob, PRIMARY KEY (`uniqueid`), UNIQUE KEY `feedid` (`feedid`), KEY `uniqueid` (`uniqueid`), diff --git a/org.glite.jp.index/src/db_ops.c b/org.glite.jp.index/src/db_ops.c index b6353eb..86cb94b 100644 --- a/org.glite.jp.index/src/db_ops.c +++ b/org.glite.jp.index/src/db_ops.c @@ -28,10 +28,10 @@ #define TABLE_PREFIX_DATA "attr_" #define SQLCMD_DROP_DATA_TABLE "DROP TABLE " TABLE_PREFIX_DATA "%s" #define SQLCMD_CREATE_DATA_TABLE "CREATE TABLE " TABLE_PREFIX_DATA "%s (\n\ - jobid CHAR(32) BINARY NOT NULL,\n\ - value %s BINARY NOT NULL,\n\ - full_value %s NOT NULL,\n\ - origin INT NOT NULL,\n\ + `jobid` CHAR(32) BINARY NOT NULL,\n\ + `value` %s BINARY NOT NULL,\n\ + `full_value` %s NOT NULL,\n\ + `origin` INT NOT NULL,\n\ \n\ INDEX (jobid),\n\ INDEX (value)\n\ @@ -343,7 +343,7 @@ int glite_jpis_initDatabase(glite_jpis_context_t ctx) { GLITE_JP_DB_TYPE_INT, &locked, GLITE_JP_DB_TYPE_VARCHAR, source, &source_len, GLITE_JP_DB_TYPE_MEDIUMBLOB, dbconds, &dbconds_len); - if (glite_jp_db_prepare(jpctx, "INSERT INTO feeds (state, locked, source, conditions) VALUES (?, ?, ?, ?)", &stmt, param, NULL) != 0) goto fail; + if (glite_jp_db_prepare(jpctx, "INSERT INTO feeds (state, locked, source, condition) VALUES (?, ?, ?, ?)", &stmt, param, NULL) != 0) goto fail; feeds = ctx->conf->feeds; i = 0; if (feeds) while (feeds[i]) { -- 1.8.2.3