You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/05/04 12:01:59 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/db/dialect OracleDialect.java MySQLDialect.java SQLDialect.java PostgreSQLDialect.java

ceki        2004/05/04 03:01:59

  Modified:    src/java/org/apache/log4j/db UrlConnectionSource.java
                        ConnectionSource.java DBAppender.java
               src/java/org/apache/log4j/db/dialect MySQLDialect.java
                        SQLDialect.java PostgreSQLDialect.java
  Added:       src/java/org/apache/log4j/db/dialect OracleDialect.java
  Log:
  - Added (untested!) support for oracle dialect. 
  - Added missing Apache copyright
  
  Revision  Changes    Path
  1.2       +4 -0      logging-log4j/src/java/org/apache/log4j/db/UrlConnectionSource.java
  
  Index: UrlConnectionSource.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/UrlConnectionSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlConnectionSource.java	4 May 2004 09:36:02 -0000	1.1
  +++ UrlConnectionSource.java	4 May 2004 10:01:59 -0000	1.2
  @@ -69,6 +69,8 @@
          extends ConnectionSourceSkeleton {
     static private final String POSTGRES_PART = "postgresql";
     static private final String MYSQL_PART = "mysql";
  +  static private final String ORACLE_PART = "oracle";
  +  
     private String driverClass = null;
     protected String url = null;
   
  @@ -149,6 +151,8 @@
         return ConnectionSource.POSTGRES_DIALECT;
       } else if (url.indexOf(MYSQL_PART) != -1) {
         return ConnectionSource.MYSQL_DIALECT;
  +    } else if (url.indexOf(ORACLE_PART) != -1) {
  +      return ConnectionSource.ORACLE_DIALECT;
       } else {
         return ConnectionSource.UNKNOWN_DIALECT;
       }
  
  
  
  1.2       +1 -1      logging-log4j/src/java/org/apache/log4j/db/ConnectionSource.java
  
  Index: ConnectionSource.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/ConnectionSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionSource.java	4 May 2004 09:36:02 -0000	1.1
  +++ ConnectionSource.java	4 May 2004 10:01:59 -0000	1.2
  @@ -35,7 +35,7 @@
     final int UNKNOWN_DIALECT = 0;
     final int POSTGRES_DIALECT = 1;
     final int MYSQL_DIALECT = 2;
  -
  +  final int ORACLE_DIALECT = 3;
     
     /**
      *  Obtain a {@link java.sql.Connection} for use.  The client is
  
  
  
  1.2       +19 -1     logging-log4j/src/java/org/apache/log4j/db/DBAppender.java
  
  Index: DBAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/DBAppender.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DBAppender.java	4 May 2004 09:36:02 -0000	1.1
  +++ DBAppender.java	4 May 2004 10:01:59 -0000	1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 1999,2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.log4j.db;
   
   import java.sql.Connection;
  @@ -6,11 +21,11 @@
   import java.sql.SQLException;
   import java.sql.Statement;
   import java.util.Iterator;
  -import java.util.Map;
   import java.util.Set;
   
   import org.apache.log4j.AppenderSkeleton;
   import org.apache.log4j.db.dialect.MySQLDialect;
  +import org.apache.log4j.db.dialect.OracleDialect;
   import org.apache.log4j.db.dialect.PostgreSQLDialect;
   import org.apache.log4j.db.dialect.SQLDialect;
   import org.apache.log4j.helpers.LogLog;
  @@ -40,6 +55,9 @@
         break;
       case ConnectionSource.MYSQL_DIALECT :
         sqlDialect = new MySQLDialect();
  +      break;
  +    case ConnectionSource.ORACLE_DIALECT :
  +      sqlDialect = new OracleDialect();
         break;
       }
     }
  
  
  
  1.2       +16 -0     logging-log4j/src/java/org/apache/log4j/db/dialect/MySQLDialect.java
  
  Index: MySQLDialect.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/MySQLDialect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MySQLDialect.java	4 May 2004 09:36:03 -0000	1.1
  +++ MySQLDialect.java	4 May 2004 10:01:59 -0000	1.2
  @@ -1,3 +1,19 @@
  +/*
  + * Copyright 1999,2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   package org.apache.log4j.db.dialect;
   
   /**
  
  
  
  1.2       +15 -1     logging-log4j/src/java/org/apache/log4j/db/dialect/SQLDialect.java
  
  Index: SQLDialect.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/SQLDialect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SQLDialect.java	4 May 2004 09:36:03 -0000	1.1
  +++ SQLDialect.java	4 May 2004 10:01:59 -0000	1.2
  @@ -1,5 +1,19 @@
  +/*
  + * Copyright 1999,2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.log4j.db.dialect;
  -
   
   /**
    * @author ceki
  
  
  
  1.2       +14 -3     logging-log4j/src/java/org/apache/log4j/db/dialect/PostgreSQLDialect.java
  
  Index: PostgreSQLDialect.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/PostgreSQLDialect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PostgreSQLDialect.java	4 May 2004 09:36:03 -0000	1.1
  +++ PostgreSQLDialect.java	4 May 2004 10:01:59 -0000	1.2
  @@ -1,13 +1,24 @@
   /*
  - * Created on May 4, 2004
  + * Copyright 1999,2004 The Apache Software Foundation.
    *
  - * To change the template for this generated file go to
  - * Window>Preferences>Java>Code Generation>Code and Comments
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  +
   package org.apache.log4j.db.dialect;
   
   
   /**
  + * 
    * @author ceki
    *
    * To change the template for this generated type comment go to
  
  
  
  1.1                  logging-log4j/src/java/org/apache/log4j/db/dialect/OracleDialect.java
  
  Index: OracleDialect.java
  ===================================================================
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.log4j.db.dialect;
  
  /**
   * The Oracle dialect is untested.
   * 
   * @author ceki
   */
  public class OracleDialect implements SQLDialect {
    public static final String SELECT_CURRVAL = "SELECT logging_event_id_seq.currval from dual";
  
    public String getSelectInsertId() {
      return SELECT_CURRVAL;
    }
  
  }
  
  
  

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