001: /*
002: * Copyright 2004-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.lucene.store.jdbc.dialect;
018:
019: /**
020: * A MySQL dialect.
021: *
022: * @author kimchy
023: */
024: public class MySQLDialect extends Dialect {
025:
026: /**
027: * MySQL requires quoting the blob column with connector J 3.1 when using emulateLocators=true.
028: */
029: public String openBlobSelectQuote() {
030: return "'";
031: }
032:
033: /**
034: * MySQL requires quoting the blob column with connector J 3.1 when using emulateLocators=true.
035: */
036: public String closeBlobSelectQuote() {
037: return "'";
038: }
039:
040: public char closeQuote() {
041: return '`';
042: }
043:
044: public char openQuote() {
045: return '`';
046: }
047:
048: /**
049: * MySQL supports select ... for update.
050: */
051: public boolean supportsForUpdate() {
052: return true;
053: }
054:
055: /**
056: * MySQL supports if exists before the table name.
057: */
058: public boolean supportsIfExistsBeforeTableName() {
059: return true;
060: }
061:
062: /**
063: * MySQL supports current timestamp selection.
064: */
065: public boolean supportsCurrentTimestampSelection() {
066: return true;
067: }
068:
069: public boolean isCurrentTimestampSelectStringCallable() {
070: return false;
071: }
072:
073: public String getCurrentTimestampSelectString() {
074: return "select now()";
075: }
076:
077: public String getVarcharType(int length) {
078: return "varchar(" + length + ")";
079: }
080:
081: public String getBlobType(long length) {
082: return "longblob";
083: }
084:
085: public String getNumberType() {
086: return "integer";
087: }
088:
089: public String getTimestampType() {
090: return "datetime";
091: }
092:
093: public String getCurrentTimestampFunction() {
094: return "current_timestamp";
095: }
096:
097: public String getBitType() {
098: return "bit";
099: }
100: }
|