OSDN Git Service

5cd958b17c537a0167fd2df27aee4ec7f5762a0d
[ea2ddl/ea2ddl.git] / ea2ddl-dao / src / main / java / jp / sourceforge / ea2ddl / dao / allcommon / cbean / sqlclause / SqlClauseH2.java
1 package jp.sourceforge.ea2ddl.dao.allcommon.cbean.sqlclause;\r
2 \r
3 \r
4 /**\r
5  * SqlClause for H2.\r
6  * \r
7  * @author DBFlute(AutoGenerator)\r
8  */\r
9 public class SqlClauseH2 extends AbstractSqlClause {\r
10 \r
11     /** String of fetch-scope as sql-suffix. */\r
12     protected String _fetchScopeSqlSuffix = "";\r
13 \r
14     /** String of lock as sql-suffix. */\r
15     protected String _lockSqlSuffix = "";\r
16 \r
17     /**\r
18      * Constructor.\r
19      * @param tableName Table name. (NotNull)\r
20      **/\r
21     public SqlClauseH2(String tableName) {\r
22         super(tableName);\r
23     }\r
24 \r
25     /**\r
26      * The implementation.\r
27      */\r
28     protected void doFetchFirst() {\r
29         doFetchPage();\r
30     }\r
31 \r
32     /**\r
33      * The implementation.\r
34      */\r
35     protected void doFetchPage() {\r
36         _fetchScopeSqlSuffix = " limit " + getFetchSize() + " offset " + getPageStartIndex();\r
37     }\r
38 \r
39     /**\r
40      * The implementation.\r
41      */\r
42     protected void doClearFetchPageClause() {\r
43         _fetchScopeSqlSuffix = "";\r
44     }\r
45 \r
46     /**\r
47      * The implementation.\r
48      * @return this. (NotNull)\r
49      */\r
50     public SqlClause lockForUpdate() {\r
51         _lockSqlSuffix = " for update";\r
52         return this;\r
53     }\r
54 \r
55     /**\r
56      * The implementation.\r
57      * @return Select-hint. (NotNull)\r
58      */\r
59     protected String createSelectHint() {\r
60         return "";\r
61     }\r
62 \r
63     /**\r
64      * The implementation.\r
65      * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)\r
66      */\r
67     protected String createFromBaseTableHint() {\r
68         return "";\r
69     }\r
70 \r
71     /**\r
72      * The implementation.\r
73      * @return From-hint. (NotNull)\r
74      */\r
75     protected String createFromHint() {\r
76         return "";\r
77     }\r
78 \r
79     /**\r
80      * The implementation.\r
81      * @return Sql-suffix. (NotNull)\r
82      */\r
83     protected String createSqlSuffix() {\r
84         return _fetchScopeSqlSuffix + _lockSqlSuffix;\r
85     }\r
86 \r
87     // [DBFlute-0.7.7]\r
88     // ===================================================================================\r
89     //                                                          Unique Constraint Override\r
90     //                                                          ==========================\r
91     @Override\r
92     public boolean isUniqueConstraintException(String sqlState, Integer errorCode) {\r
93         return "23001".equals(sqlState);\r
94     }\r
95 }\r