01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.lucene.store.jdbc.dialect;
18:
19: /**
20: * An Oracle dialect. Works for Oracle 9 and above.
21: *
22: * @author kimchy
23: */
24: public class OracleDialect extends Dialect {
25:
26: /**
27: * Oracle supports transactional scopes blobs.
28: */
29: public boolean supportTransactionalScopedBlobs() {
30: return true;
31: }
32:
33: /**
34: * Oracle supports select ... for update.
35: */
36: public boolean supportsForUpdate() {
37: return true;
38: }
39:
40: /**
41: * Oracle supports if table exists queries.
42: */
43: public boolean supportsTableExists() {
44: return true;
45: }
46:
47: public String sqlTableExists(String catalog, String schemaName) {
48: if (schemaName == null) {
49: return "select table_name from user_tables where lower(table_name) = ?";
50: }
51: return "select table_name from all_tables where lower(owner) = '"
52: + schemaName.toLowerCase()
53: + "' and lower(table_name) = ?";
54: }
55:
56: public String getCascadeConstraintsString() {
57: return " cascade constraints";
58: }
59:
60: public String getForUpdateNowaitString() {
61: return " for update nowait";
62: }
63:
64: public boolean supportsCurrentTimestampSelection() {
65: return true;
66: }
67:
68: public String getCurrentTimestampSelectString() {
69: return "select systimestamp from dual";
70: }
71:
72: public boolean isCurrentTimestampSelectStringCallable() {
73: return false;
74: }
75:
76: public String getVarcharType(int length) {
77: return "varchar2(" + length + " char)";
78: }
79:
80: public String getBlobType(long length) {
81: return "blob";
82: }
83:
84: public String getNumberType() {
85: return "number(10,0)";
86: }
87:
88: public String getTimestampType() {
89: return "timestamp";
90: }
91:
92: public String getCurrentTimestampFunction() {
93: return "current_timestamp";
94: }
95:
96: public String getBitType() {
97: return "number(1,0)";
98: }
99: }
|