edu.ucsb.nceas.dbadapter
Class SqlserverAdapter

java.lang.Object
  |
  +--edu.ucsb.nceas.dbadapter.AbstractDatabase
        |
        +--edu.ucsb.nceas.dbadapter.SqlserverAdapter

public class SqlserverAdapter
extends AbstractDatabase

The MS SQL Server db adapter implementation.


Constructor Summary
SqlserverAdapter()
           
 
Method Summary
 java.lang.String getDateTimeFunction()
          The SQL Server's function name that gets the current date and time from the database server: "getdate()"
 java.lang.String getIsNULLFunction()
          The SQL Server's function name that is used to return non-NULL value
 java.lang.String getStringDelimiter()
          The SQL Server's string delimiter character: single quote (')
 long getUniqueID(java.sql.Connection conn, java.lang.String tableName)
          The SQL Server unique ID generator through use of IDENTITY key The IDENTITY key is a column in the table.
 java.lang.String toDate(java.lang.String dateString, java.lang.String format)
          MSSQL doesn't support the to_date function, so we transfer text directly.
 
Methods inherited from class edu.ucsb.nceas.dbadapter.AbstractDatabase
createObject, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlserverAdapter

public SqlserverAdapter()
Method Detail

getUniqueID

public long getUniqueID(java.sql.Connection conn,
                        java.lang.String tableName)
                 throws java.sql.SQLException
The SQL Server unique ID generator through use of IDENTITY key The IDENTITY key is a column in the table. When record is inserted in the table, SELECT @@IDENTITY can return the key generated in that IDENTITY column in the same db connection. This is the only way to get unique id: let the SQL Server assign a value in IDENTITY column and get it afterwards for use in the application.

Specified by:
getUniqueID in class AbstractDatabase
Parameters:
conn - db connection in which to generate the unique id
tableName - the name of table which unique id to generate
Returns:
return the generated unique id as a long type
Throws:
java.sql.SQLException -
any SQLException that can be thrown during the db operation

getDateTimeFunction

public java.lang.String getDateTimeFunction()
The SQL Server's function name that gets the current date and time from the database server: "getdate()"

Specified by:
getDateTimeFunction in class AbstractDatabase
Returns:
return the current date and time function name: "getdate()"

getIsNULLFunction

public java.lang.String getIsNULLFunction()
The SQL Server's function name that is used to return non-NULL value

Specified by:
getIsNULLFunction in class AbstractDatabase
Returns:
return the non-NULL function name: "isnull"

getStringDelimiter

public java.lang.String getStringDelimiter()
The SQL Server's string delimiter character: single quote (')

Specified by:
getStringDelimiter in class AbstractDatabase
Returns:
return the string delimiter: single quote (')

toDate

public java.lang.String toDate(java.lang.String dateString,
                               java.lang.String format)
MSSQL doesn't support the to_date function, so we transfer text directly. This method will overwrite the method in AbstarctDatabase class

Overrides:
toDate in class AbstractDatabase


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.