Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/jdbf/engine/sql/SqlServerInterface.java


1   /*
2    * 20/01/2003 - 10:07:11
3    *
4    * SQLServerInterface.java - JDBF Object Relational mapping system
5    * Copyright (C) 2002 Giovanni Martone
6    * giovannimartone@hotmail.com
7    * http://jdbf.sourceforge.net
8    *
9    * This program is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public License
11   * as published by the Free Software Foundation; either version 2
12   * of the License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public License
20   * along with this program; if not, write to the Free Software
21   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22   */
23  
24  package org.jdbf.engine.sql;
25  
26  import org.jdbf.engine.mapping.MappingException;
27  
28  /**
29   * It's overrides SqlInterface's methods for constructing sql statements
30   * where MS SQL Server implementation differs from ANSI or is not specified by ANSI.
31   *
32   * @author Giovanni Martone
33   * @version $id$
34   *
35   */
36  
37  public class SqlServerInterface extends SqlInterface {
38  
39      public SqlServerInterface() {}
40  
41      
42    /**
43     * Return the cluase of current timeStamp
44     *
45     * @return current timeStamp
46     * @throws MappingExpcetion if feature not supported
47     */    
48    public String getClauseStringCurrentTimeStamp() {
49      return "GETDATE()";
50      }
51    
52    
53    /**
54     * Return the current timeStamp statement
55     *
56     * @return current timestamp statement
57     * @overrides SqlInterface.getCurrentTimeStampStatement
58     */
59      public String getCurrentTimeStampStatement() {
60      return "SELECT GETDATE()";
61      }
62    
63    
64    /**
65       * Forms an sql insert id statement
66     *
67     * NEWID() returns a 16-byte binary value (GUID)
68       * for example: 6F9619FF-8B86-D011-D42D-00C04FC964FF   
69     * @param name
70     * @return Sql statement for selecting a insert id key.
71     * @throws MappingException
72     * @see MySqlInterface.getSelectInsertIdStatement
73     *
74       */  
75      public String getSelectInsertIdStatement() {
76      return "SELECT NEWID()";
77      }    
78  }