Proper fix for the MySQL keyword problem. DB structure remains the same as in previou...
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 14 Aug 2007 17:01:04 +0000 (17:01 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 14 Aug 2007 17:01:04 +0000 (17:01 +0000)
org.glite.jp.index/config/glite-jp-index-dbsetup.sql
org.glite.jp.index/examples/query-tests/dump1.sql
org.glite.jp.index/src/db_ops.c

index e0f7f88..97a5a2f 100644 (file)
@@ -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_<attrid> (
-#        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)
index ef17d40..1953b66 100644 (file)
@@ -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`),
index b6353eb..86cb94b 100644 (file)
 #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]) {