Project

General

Profile

« Previous | Next » 

Revision 1745

Added by Jing Tao almost 21 years ago

Add new method to handle toDate function.

View differences:

src/edu/ucsb/nceas/dbadapter/PostgresqlAdapter.java
100 100
    return "\"";
101 101
  }
102 102
  
103
 /**
104
  * Postgresql support the to_date function, so we use it
105
  */
106
  public String toDate(String dateString, String format)
107
  {
108
    return "to_date(" + "'"+ dateString + "', '" + format + "')";
109
  }
110
  
103 111
}
104 112
    
src/edu/ucsb/nceas/dbadapter/OracleAdapter.java
99 99
    return "'";
100 100
  }
101 101
  
102
 /**
103
  * Oracle support the to_date function, so we use it
104
  */
105
  public String toDate(String dateString, String format)
106
  {
107
     return "to_date(" + "'"+ dateString + "', '" + format + "')";
108
  }
109
  
102 110
}
103 111
    
src/edu/ucsb/nceas/dbadapter/SqlserverAdapter.java
97 97
    return "'";
98 98
  }
99 99
  
100
 /**
101
  * MSSQL doesn't support the to_date function, so we transfer text directly
102
  */
103
  public String toDate(String dateString, String format)
104
  {
105
    return dateString;
106
  }
107
  
100 108
}
101 109
    
src/edu/ucsb/nceas/dbadapter/AbstractDatabase.java
84 84
  public abstract String getStringDelimiter();
85 85
  
86 86
  /**
87
   * MSSQL didn't support to_date function which to transfer a text string
88
   * to date type. But Oracle and Postsql do.
89
   */
90
  public abstract String toDate(String dateString, String format);
91
  
92
  
93
  /**
87 94
   * Instantiate a class using the name of the class at runtime
88 95
   *
89 96
   * @param className the fully qualified name of the class to instantiate

Also available in: Unified diff