logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Stauffer <jstau...@spscommerce.com>
Subject RE: cvs commit: logging-log4j/src/java/org/apache/log4j/db Connec tionSource.java DataSourceConnectionSource.java DriverManagerConnectionSo urce.java
Date Tue, 18 May 2004 17:02:19 GMT
For DriverManagerConnectionSource.java it looks like you added the Oracle
check twice.

  @@ -151,6 +152,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 if (url.indexOf(ORACLE_PART) != -1) {
         return ConnectionSource.ORACLE_DIALECT;
       } else {
James Stauffer


-----Original Message-----
From: ceki@apache.org [mailto:ceki@apache.org] 
Sent: Tuesday, May 18, 2004 12:00 PM
To: logging-log4j-cvs@apache.org
Subject: cvs commit: logging-log4j/src/java/org/apache/log4j/db
ConnectionSource.java DataSourceConnectionSource.java
DriverManagerConnectionSource.java


ceki        2004/05/18 10:00:08

  Modified:    src/java/org/apache/log4j/db ConnectionSource.java
                        DataSourceConnectionSource.java
                        DriverManagerConnectionSource.java
  Added:       src/java/org/apache/log4j/db/dialect MsSQLDialect.java
                        mssql.sql
  Log:
  Added support for MSSQL as contributed by James Stauffer.
  
  Revision  Changes    Path
  1.1
logging-log4j/src/java/org/apache/log4j/db/dialect/MsSQLDialect.java
  
  Index: MsSQLDialect.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 MS SQL Server dialect is untested. 
  * 
  * @author James Stauffer 
  */ 
  public class MsSQLDialect implements SQLDialect { 
   public static final String SELECT_CURRVAL = "SELECT @@identity id"; 
  
   public String getSelectInsertId() { 
     return SELECT_CURRVAL; 
   } 
  }
  
  
  
  1.1
logging-log4j/src/java/org/apache/log4j/db/dialect/mssql.sql
  
  Index: mssql.sql
  ===================================================================
  -- This SQL script creates the required tables by
org.apache.log4j.db.DBAppender and 
  -- org.apache.log4j.db.DBReceiver. 
  -- 
  -- It is intended for MS SQL Server databases.  This has been tested with
version 7.0. 
  
  DROP TABLE logging_event_property 
  DROP TABLE logging_event_exception 
  DROP TABLE logging_event 
  
  CREATE TABLE logging_event 
    ( 
      sequence_number   DECIMAL(20) NOT NULL, 
      timestamp         DECIMAL(20) NOT NULL, 
      rendered_message  TEXT NOT NULL, 
      logger_name       VARCHAR(254) NOT NULL, 
      level_string      VARCHAR(254) NOT NULL, 
      ndc               TEXT, 
      thread_name       VARCHAR(254), 
      reference_flag    SMALLINT, 
      event_id          INT NOT NULL identity, 
      PRIMARY KEY(event_id) 
    ) 
  
  CREATE TABLE logging_event_property 
    ( 
      event_id          INT NOT NULL, 
      mapped_key        VARCHAR(254) NOT NULL, 
      mapped_value      TEXT, 
      PRIMARY KEY(event_id, mapped_key), 
      FOREIGN KEY (event_id) REFERENCES logging_event(event_id) 
    ) 
  
  CREATE TABLE logging_event_exception 
    ( 
      event_id         INT NOT NULL, 
      i                SMALLINT NOT NULL, 
      trace_line       VARCHAR(254) NOT NULL, 
      PRIMARY KEY(event_id, i), 
      FOREIGN KEY (event_id) REFERENCES logging_event(event_id) 
    ) 
  
  
  
  
  1.3       +1 -0
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectionSource.java	4 May 2004 10:01:59 -0000	1.2
  +++ ConnectionSource.java	18 May 2004 17:00:08 -0000	1.3
  @@ -36,6 +36,7 @@
     final int POSTGRES_DIALECT = 1;
     final int MYSQL_DIALECT = 2;
     final int ORACLE_DIALECT = 3;
  +  final int MSSQL_DIALECT = 4;
     
     /**
      *  Obtain a {@link java.sql.Connection} for use.  The client is
  
  
  
  1.2       +4 -0
logging-log4j/src/java/org/apache/log4j/db/DataSourceConnectionSource.java
  
  Index: DataSourceConnectionSource.java
  ===================================================================
  RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/db/DataSourceConnectionSou
rce.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DataSourceConnectionSource.java	18 May 2004 16:50:42 -0000	1.1
  +++ DataSourceConnectionSource.java	18 May 2004 17:00:08 -0000	1.2
  @@ -38,6 +38,8 @@
     private static final String POSTGRES_PART = "postgresql";
     private static final String MYSQL_PART = "mysql";
     private static final String ORACLE_PART = "oracle";
  +  private static final String MSSQL_PART = "mssqlserver4"; 
  +  
     private DataSource dataSource;
     int dialectCode;
     
  @@ -100,6 +102,8 @@
           return ConnectionSource.MYSQL_DIALECT;
         } else if (dbName.indexOf(ORACLE_PART) != -1) {
           return ConnectionSource.ORACLE_DIALECT;
  +      } else if (dbName.indexOf(MSSQL_PART) != -1) {
  +        return ConnectionSource.MSSQL_DIALECT;
         } else {
           return ConnectionSource.UNKNOWN_DIALECT;
         }
  
  
  
  1.2       +3 -0
logging-log4j/src/java/org/apache/log4j/db/DriverManagerConnectionSource.jav
a
  
  Index: DriverManagerConnectionSource.java
  ===================================================================
  RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/db/DriverManagerConnection
Source.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DriverManagerConnectionSource.java	18 May 2004 16:50:42 -0000
1.1
  +++ DriverManagerConnectionSource.java	18 May 2004 17:00:08 -0000
1.2
  @@ -70,6 +70,7 @@
     static private final String POSTGRES_PART = "postgresql";
     static private final String MYSQL_PART = "mysql";
     static private final String ORACLE_PART = "oracle";
  +  static private final String MSSQL_PART = "mssql"; 
     
     private String driverClass = null;
     protected String url = null;
  @@ -151,6 +152,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 if (url.indexOf(ORACLE_PART) != -1) {
         return ConnectionSource.ORACLE_DIALECT;
       } else {
  
  
  

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

Mime
View raw message