001/*
002 * HA-JDBC: High-Availability JDBC
003 * Copyright (C) 2012  Paul Ferraro
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Lesser General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Lesser General Public License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018package net.sf.hajdbc.dialect.mckoi;
019
020import net.sf.hajdbc.SequenceSupport;
021import net.sf.hajdbc.dialect.StandardDialect;
022
023/**
024 * Dialect for <a href="http://mckoi.com">Mckoi</a>.
025 * 
026 * @author Paul Ferraro
027 */
028@SuppressWarnings("nls")
029public class MckoiDialect extends StandardDialect
030{
031        /**
032         * {@inheritDoc}
033         * @see net.sf.hajdbc.dialect.StandardDialect#vendorPattern()
034         */
035        @Override
036        protected String vendorPattern()
037        {
038                return "mckoi";
039        }
040
041        /**
042         * {@inheritDoc}
043         * @see net.sf.hajdbc.dialect.StandardDialect#getSequenceSupport()
044         */
045        @Override
046        public SequenceSupport getSequenceSupport()
047        {
048                return this;
049        }
050
051        /**
052         * @see net.sf.hajdbc.dialect.StandardDialect#sequencePattern()
053         */
054        @Override
055        protected String sequencePattern()
056        {
057                return "(?:CURR|NEXT)VAL\\s*\\(\\s*'([^']+)'\\s*\\)";
058        }
059
060        /**
061         * @see net.sf.hajdbc.dialect.StandardDialect#currentTimestampPattern()
062         */
063        @Override
064        protected String currentTimestampPattern()
065        {
066                return super.currentTimestampPattern() + "|(?<=\\W)DATEOB\\s*\\(\\s*\\)";
067        }
068}