empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r746769 - /incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
Date Sun, 22 Feb 2009 16:56:01 GMT
Author: francisdb
Date: Sun Feb 22 16:56:01 2009
New Revision: 746769

URL: http://svn.apache.org/viewvc?rev=746769&view=rev
Log:
add the extra database drivers

Modified:
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java

Modified: incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java?rev=746769&r1=746768&r2=746769&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
(original)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
Sun Feb 22 16:56:01 2009
@@ -206,6 +206,26 @@
             DBDatabaseDriverHSql driver = new DBDatabaseDriverHSql();
             // Set Driver specific properties (if any)
             return driver;
+        }else if (provider.equalsIgnoreCase("postgresql"))
+        {
+            DBDatabaseDriverPostgreSQL driver = new DBDatabaseDriverPostgreSQL();
+            // Set Driver specific properties (if any)
+            driver.setDatabaseName(config.getSchemaName());
+            return driver;
+        }
+        else if (provider.equalsIgnoreCase("h2"))
+        {
+            DBDatabaseDriverH2 driver = new DBDatabaseDriverH2();
+            // Set Driver specific properties (if any)
+            driver.setDatabaseName(config.getSchemaName());
+            return driver;
+        }
+        else if (provider.equalsIgnoreCase("derby"))
+        {
+            DBDatabaseDriverDerby driver = new DBDatabaseDriverDerby();
+            // Set Driver specific properties (if any)
+            driver.setDatabaseName(config.getSchemaName());
+            return driver;
         }
         else
         {   // Unknown Provider
@@ -357,9 +377,12 @@
         // e.g. substr(PHONE_NUMBER, length(PHONE_NUMBER)-instr(reverse(PHONE_NUMBER), '-')+2)
AS PHONE_EXTENSION
         // Hint: Since the reverse() function is not supported by HSQLDB there is special
treatment for HSQL
         DBColumnExpr PHONE_LAST_DASH;
-        if ( db.getDriver() instanceof DBDatabaseDriverHSql )
+        if ( db.getDriver() instanceof DBDatabaseDriverHSql 
+        		|| db.getDriver() instanceof DBDatabaseDriverPostgreSQL
+        		|| db.getDriver() instanceof DBDatabaseDriverDerby
+        		|| db.getDriver() instanceof DBDatabaseDriverH2)
              PHONE_LAST_DASH = EMP.PHONE_NUMBER.indexOf("-", EMP.PHONE_NUMBER.indexOf("-").plus(1)).plus(1);
// HSQLDB only
-        else PHONE_LAST_DASH = EMP.PHONE_NUMBER.length().minus(EMP.PHONE_NUMBER.reverse().indexOf("-")).plus(2);

+        else PHONE_LAST_DASH = EMP.PHONE_NUMBER.length().minus(EMP.PHONE_NUMBER.reverse().indexOf("-")).plus(2);
 
         DBColumnExpr PHONE_EXT_NUMBER = EMP.PHONE_NUMBER.substring(PHONE_LAST_DASH).as("PHONE_EXTENSION");
         
         // DBColumnExpr genderExpr = cmd.select(EMP.GENDER.decode(EMP.GENDER.getOptions()).as(EMP.GENDER.getName()));



Mime
View raw message