You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2003/11/26 16:18:10 UTC

cvs commit: jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms MySqlSchema.sql StandardRDBMSAdapter.java MySqlRDBMSAdapter.java

ozeigermann    2003/11/26 07:18:10

  Modified:    proposals/stores/org/apache/slide/store/impl/rdbms
                        MySqlSchema.sql StandardRDBMSAdapter.java
                        MySqlRDBMSAdapter.java
  Log:
  - Unified adapters
  - Made int(11) BIGINT for MySQL
  
  Contributed by
  - Pier Fumagalli
  - Alexander Wendt
  
  Revision  Changes    Path
  1.3       +27 -27    jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlSchema.sql
  
  Index: MySqlSchema.sql
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlSchema.sql,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MySqlSchema.sql	26 Nov 2003 10:07:09 -0000	1.2
  +++ MySqlSchema.sql	26 Nov 2003 15:18:10 -0000	1.3
  @@ -18,7 +18,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE URI (
  -  URI_ID       int(11)       NOT NULL auto_increment,
  +  URI_ID       bigint       NOT NULL auto_increment,
     URI_STRING   varchar(255)  NOT NULL,
     PRIMARY KEY  (URI_ID),
     KEY URI_IX2  (URI_STRING)
  @@ -27,7 +27,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE OBJECT (
  -  URI_ID      int(11)       NOT NULL,
  +  URI_ID      bigint       NOT NULL,
     CLASS_NAME  varchar(255)  NOT NULL,
     PRIMARY KEY (URI_ID)
   ) TYPE=InnoDB;
  @@ -38,8 +38,8 @@
   # --------------------------------------------------------
   
   CREATE TABLE CHILDREN (
  -  URI_ID         int(11)  NOT NULL,
  -  CHILD_URI_ID   int(11)  NOT NULL,
  +  URI_ID         bigint  NOT NULL,
  +  CHILD_URI_ID   bigint  NOT NULL,
     PRIMARY KEY    (URI_ID,CHILD_URI_ID),
     key CHILD_IX2  (CHILD_URI_ID)
   ) TYPE=InnoDB;
  @@ -52,8 +52,8 @@
   # --------------------------------------------------------
   
   CREATE TABLE LINKS (
  -  URI_ID        int(11)  NOT NULL,
  -  LINK_TO_ID    int(11)  NOT NULL,
  +  URI_ID        bigint  NOT NULL,
  +  LINK_TO_ID    bigint  NOT NULL,
     PRIMARY KEY   (URI_ID,LINK_TO_ID),
     key LINK_IX2  (LINK_TO_ID)
   ) TYPE=InnoDB;
  @@ -66,11 +66,11 @@
   # --------------------------------------------------------
   
   CREATE TABLE LOCKS (
  -  LOCK_ID          int(11)     NOT NULL,
  -  OBJECT_ID        int(11)     NOT NULL,
  -  SUBJECT_ID       int(11)     NOT NULL,
  -  TYPE_ID          int(11)     NOT NULL,
  -  EXPIRATION_DATE  date        NOT NULL,
  +  LOCK_ID          bigint     NOT NULL,
  +  OBJECT_ID        bigint     NOT NULL,
  +  SUBJECT_ID       bigint     NOT NULL,
  +  TYPE_ID          bigint     NOT NULL,
  +  EXPIRATION_DATE  bigint        NOT NULL,
     IS_INHERITABLE   tinyint(1)  NOT NULL,
     IS_EXCLUSIVE     tinyint(1)  NOT NULL,
     PRIMARY KEY      (LOCK_ID),
  @@ -91,7 +91,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE BRANCH (
  -  BRANCH_ID      int(11)       NOT NULL auto_increment,
  +  BRANCH_ID      bigint       NOT NULL auto_increment,
     BRANCH_STRING  varchar(255)  NOT NULL,
     PRIMARY KEY    (BRANCH_ID)
   ) TYPE=InnoDB;
  @@ -99,7 +99,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE LABEL (
  -  LABEL_ID      int(11)       NOT NULL auto_increment,
  +  LABEL_ID      bigint       NOT NULL auto_increment,
     LABEL_STRING  varchar(255)  NOT NULL,
     PRIMARY KEY   (LABEL_ID)
   ) TYPE=InnoDB;
  @@ -107,7 +107,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE VERSION (
  -  URI_ID        int(11)     NOT NULL,
  +  URI_ID        bigint     NOT NULL,
     IS_VERSIONED  tinyint(1)  NOT NULL,
     PRIMARY KEY   (URI_ID)
   ) TYPE=InnoDB;
  @@ -118,9 +118,9 @@
   # --------------------------------------------------------
   
   CREATE TABLE VERSION_HISTORY (
  -  VERSION_ID   int(11)      NOT NULL auto_increment,
  -  URI_ID       int(11)      NOT NULL,
  -  BRANCH_ID    int(11)      NOT NULL,
  +  VERSION_ID   bigint      NOT NULL auto_increment,
  +  URI_ID       bigint      NOT NULL,
  +  BRANCH_ID    bigint      NOT NULL,
     REVISION_NO  varchar(20)  NOT NULL,
     PRIMARY KEY  (VERSION_ID),
     UNIQUE KEY URI_ID (BRANCH_ID,URI_ID,REVISION_NO),
  @@ -135,8 +135,8 @@
   # --------------------------------------------------------
   
   CREATE TABLE VERSION_PREDS (
  -  VERSION_ID      int(11)  NOT NULL,
  -  PREDECESSOR_ID  int(11)  NOT NULL,
  +  VERSION_ID      bigint  NOT NULL,
  +  PREDECESSOR_ID  bigint  NOT NULL,
     PRIMARY KEY     (VERSION_ID,PREDECESSOR_ID),
     KEY PREDECESSOR_ID_IX2 (PREDECESSOR_ID)
   ) TYPE=InnoDB;
  @@ -149,8 +149,8 @@
   # --------------------------------------------------------
   
   CREATE TABLE VERSION_LABELS (
  -  VERSION_ID   int(11)  NOT NULL,
  -  LABEL_ID     int(11)  NOT NULL,
  +  VERSION_ID   bigint  NOT NULL,
  +  LABEL_ID     bigint  NOT NULL,
     PRIMARY KEY  (VERSION_ID,LABEL_ID),
     KEY LABEL_ID_IX2 (LABEL_ID)
   ) TYPE=InnoDB;
  @@ -163,7 +163,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE VERSION_CONTENT (
  -  VERSION_ID   int(11)  NOT NULL,
  +  VERSION_ID   bigint  NOT NULL,
     CONTENT      blob     NOT NULL,
     PRIMARY KEY  (VERSION_ID)
   ) TYPE=InnoDB;
  @@ -174,7 +174,7 @@
   # --------------------------------------------------------
   
   CREATE TABLE PROPERTIES (
  -  VERSION_ID          int(11)       NOT NULL,
  +  VERSION_ID          bigint       NOT NULL,
     PROPERTY_NAMESPACE  varchar(50)   NOT NULL,
     PROPERTY_NAME       varchar(50)   NOT NULL,
     PROPERTY_VALUE      varchar(255)  NOT NULL,
  @@ -189,13 +189,13 @@
   # --------------------------------------------------------
   
   CREATE TABLE PERMISSIONS (
  -  OBJECT_ID       int(11)      NOT NULL,
  -  SUBJECT_ID      int(11)      NOT NULL,
  -  ACTION_ID       int(11)      NOT NULL,
  +  OBJECT_ID       bigint      NOT NULL,
  +  SUBJECT_ID      bigint      NOT NULL,
  +  ACTION_ID       bigint      NOT NULL,
     VERSION_NO      varchar(20),
     IS_INHERITABLE  tinyint(1)   NOT NULL,
     IS_NEGATIVE     tinyint(1)   NOT NULL,
  -  SUCCESSION      int(11)      NOT NULL,
  +  SUCCESSION      int         NOT NULL,
     PRIMARY KEY     (SUBJECT_ID,OBJECT_ID,ACTION_ID),
     UNIQUE KEY OBJECT_ID_2 (OBJECT_ID,SUCCESSION),
     KEY ACTION_ID_IX3 (ACTION_ID)
  
  
  
  1.9       +6 -6      jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/StandardRDBMSAdapter.java
  
  Index: StandardRDBMSAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/StandardRDBMSAdapter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardRDBMSAdapter.java	26 Nov 2003 14:54:51 -0000	1.8
  +++ StandardRDBMSAdapter.java	26 Nov 2003 15:18:10 -0000	1.9
  @@ -382,7 +382,7 @@
           try {
               statement =
                   connection.prepareStatement(
  -                    "select l.EXPIRATION_DATE, l.IS_INHERITABLE, l.IS_EXCLUSIVE, u2.URI_STRING as LOCK, u3.URI_STRING as SUBJECT, u4.URI_STRING as TYPE from LOCKS l, URI u, URI u2, URI u3, URI u4 where l.OBJECT_ID=u.URI_ID and u.URI_STRING=? and l.LOCK_ID=u2.URI_ID and l.SUBJECT_ID=u3.URI_ID and l.TYPE_ID = u4.URI_ID");
  +                    "select l.EXPIRATION_DATE, l.IS_INHERITABLE, l.IS_EXCLUSIVE, u2.URI_STRING as LCK, u3.URI_STRING as SUBJECT, u4.URI_STRING as TYPE from LOCKS l, URI u, URI u2, URI u3, URI u4 where l.OBJECT_ID=u.URI_ID and u.URI_STRING=? and l.LOCK_ID=u2.URI_ID and l.SUBJECT_ID=u3.URI_ID and l.TYPE_ID = u4.URI_ID");
               statement.setString(1, uri.toString());
               res = statement.executeQuery();
   
  @@ -397,7 +397,7 @@
                   }
                   NodeLock lock =
                       new NodeLock(
  -                        res.getString("LOCK"),
  +                        res.getString("LCK"),
                           uri.toString(),
                           res.getString("SUBJECT"),
                           res.getString("TYPE"),
  
  
  
  1.2       +2 -52     jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlRDBMSAdapter.java
  
  Index: MySqlRDBMSAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlRDBMSAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MySqlRDBMSAdapter.java	25 Nov 2003 09:19:17 -0000	1.1
  +++ MySqlRDBMSAdapter.java	26 Nov 2003 15:18:10 -0000	1.2
  @@ -64,17 +64,8 @@
   package org.apache.slide.store.impl.rdbms;
   
   import org.apache.slide.common.*;
  -import org.apache.slide.lock.NodeLock;
   import org.apache.slide.util.logger.Logger;
   
  -import java.sql.Connection;
  -import java.sql.PreparedStatement;
  -import java.sql.ResultSet;
  -import java.sql.SQLException;
  -
  -import java.util.*;
  -import java.util.Date;
  -
   /**
    * Adapter for MySQL 4.
    * 
  @@ -88,47 +79,6 @@
   
       public MySqlRDBMSAdapter(Service service, Logger logger) {
           super(service, logger);
  -    }
  -
  -    public Enumeration enumerateLocks(Connection connection, Uri uri) throws ServiceAccessException {
  -
  -        Vector lockVector = new Vector();
  -        PreparedStatement statement = null;
  -        ResultSet res = null;
  -        try {
  -            statement =
  -                connection.prepareStatement(
  -                    "select l.EXPIRATION_DATE, l.IS_INHERITABLE, l.IS_EXCLUSIVE, u2.URI_STRING as LCK, u3.URI_STRING as SUBJECT, u4.URI_STRING as TYPE from LOCKS l, URI u, URI u2, URI u3, URI u4 where l.OBJECT_ID=u.URI_ID and u.URI_STRING=? and l.LOCK_ID=u2.URI_ID and l.SUBJECT_ID=u3.URI_ID and l.TYPE_ID = u4.URI_ID");
  -            statement.setString(1, uri.toString());
  -            res = statement.executeQuery();
  -
  -            while (res.next()) {
  -                Date expirationDate = null;
  -                try {                   
  -                    expirationDate = res.getDate("EXPIRATION_DATE");
  -                } catch (NumberFormatException e) {
  -                    getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
  -                    expirationDate = new Date();
  -                }
  -                NodeLock lock =
  -                    new NodeLock(
  -                        res.getString("LCK"),
  -                        uri.toString(),
  -                        res.getString("SUBJECT"),
  -                        res.getString("TYPE"),
  -                        expirationDate,
  -                        res.getInt("IS_INHERITABLE") == 1,
  -                        res.getInt("IS_EXCLUSIVE") == 1);
  -
  -                lockVector.addElement(lock);
  -            }
  -        } catch (SQLException e) {
  -            getLogger().log(e, LOG_CHANNEL, Logger.ERROR);
  -            throw new ServiceAccessException(service, e);
  -        } finally {
  -            close(statement, res);
  -        }
  -        return lockVector.elements();
       }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms MySqlSchema.sql StandardRDBMSAdapter.java MySqlRDBMSAdapter.java

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
Christopher Lenz wrote:
>>     Index: MySqlSchema.sql
>>   ===================================================================
>>   RCS file: 
>> /home/cvs/jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlSchema.sql,v 
>>
>>   retrieving revision 1.2
>>   retrieving revision 1.3
>>   diff -u -r1.2 -r1.3
>>   --- MySqlSchema.sql    26 Nov 2003 10:07:09 -0000    1.2
>>   +++ MySqlSchema.sql    26 Nov 2003 15:18:10 -0000    1.3
>>   @@ -18,7 +18,7 @@
>>    # --------------------------------------------------------
> 
> 
> Oliver, this file seems to have been added as binary, as indicated by 
> the extra empty lines resulting from missing line-end conversion. You 
> should consider converting this file to kv ("Substitute keyword and 
> value"):
> 
>   $ cvs admin -kkv MySqlSchema.sql
> 
> (If you use Eclipse, you can add the .sql extension to the file types 
> recognized by the CVS plug-in, and set it to ASCII; there's also a GUI 
> for changing the keyword substitution mode)
> 
> -chris

Thanks! Should be fixed now. Could you please verify!

Oliver



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms MySqlSchema.sql StandardRDBMSAdapter.java MySqlRDBMSAdapter.java

Posted by Christopher Lenz <cm...@gmx.de>.
ozeigermann@apache.org wrote:
> ozeigermann    2003/11/26 07:18:10
> 
>   Modified:    proposals/stores/org/apache/slide/store/impl/rdbms
>                         MySqlSchema.sql StandardRDBMSAdapter.java
>                         MySqlRDBMSAdapter.java
>   Log:
>   - Unified adapters
>   - Made int(11) BIGINT for MySQL
> 
>   Contributed by
>   - Pier Fumagalli
>   - Alexander Wendt
>   
>   Revision  Changes    Path
>   1.3       +27 -27    jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlSchema.sql
>   
>   Index: MySqlSchema.sql
>   ===================================================================
>   RCS file: /home/cvs/jakarta-slide/proposals/stores/org/apache/slide/store/impl/rdbms/MySqlSchema.sql,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- MySqlSchema.sql	26 Nov 2003 10:07:09 -0000	1.2
>   +++ MySqlSchema.sql	26 Nov 2003 15:18:10 -0000	1.3
>   @@ -18,7 +18,7 @@
>    # --------------------------------------------------------

Oliver, this file seems to have been added as binary, as indicated by the 
extra empty lines resulting from missing line-end conversion. You should 
consider converting this file to kv ("Substitute keyword and value"):

   $ cvs admin -kkv MySqlSchema.sql

(If you use Eclipse, you can add the .sql extension to the file types 
recognized by the CVS plug-in, and set it to ASCII; there's also a GUI for 
changing the keyword substitution mode)

-chris

>    CREATE TABLE URI (
> 
>   -  URI_ID       int(11)       NOT NULL auto_increment,
> 
>   +  URI_ID       bigint       NOT NULL auto_increment,
> 
>      URI_STRING   varchar(255)  NOT NULL,
> 
>      PRIMARY KEY  (URI_ID),
> 
>      KEY URI_IX2  (URI_STRING)
> 
>   @@ -27,7 +27,7 @@
>    # --------------------------------------------------------
[snip]


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org