001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.dao.db;
016    
017    import com.liferay.portal.kernel.dao.db.DB;
018    import com.liferay.portal.kernel.util.StringUtil;
019    
020    import java.io.IOException;
021    
022    /**
023     * @author Alexander Chow
024     * @author Sandeep Soni
025     * @author Ganesh Ram
026     */
027    public class JDataStoreDB extends FirebirdDB {
028    
029            public static DB getInstance() {
030                    return _instance;
031            }
032    
033            @Override
034            public String buildSQL(String template) throws IOException {
035                    template = convertTimestamp(template);
036                    template = replaceTemplate(template, getTemplate());
037    
038                    template = reword(template);
039                    template = StringUtil.replace(
040                            template,
041                            new String[] {"\\'", "\\\"", "\\\\",  "\\n", "\\r"},
042                            new String[] {"''", "\"", "\\", "\n", "\r"});
043    
044                    return template;
045            }
046    
047            protected JDataStoreDB() {
048                    super(TYPE_JDATASTORE);
049            }
050    
051            @Override
052            protected String getServerName() {
053                    return "jdatastore";
054            }
055    
056            @Override
057            protected String[] getTemplate() {
058                    return _JDATASTORE;
059            }
060    
061            private static String[] _JDATASTORE = {
062                    "--", "TRUE", "FALSE",
063                    "'1970-01-01'", "current_timestamp",
064                    " binary", " boolean", " date",
065                    " double", " integer", " bigint",
066                    " long varchar", " long varchar", " varchar",
067                    "", "commit"
068            };
069    
070            private static JDataStoreDB _instance = new JDataStoreDB();
071    
072    }