001    /**
002     * Copyright (c) 2000-2010 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            public String buildSQL(String template) throws IOException {
034                    template = convertTimestamp(template);
035                    template = replaceTemplate(template, getTemplate());
036    
037                    template = reword(template);
038                    template = StringUtil.replace(
039                            template,
040                            new String[] {"\\'", "\\\"", "\\\\",  "\\n", "\\r"},
041                            new String[] {"''", "\"", "\\", "\n", "\r"});
042    
043                    return template;
044            }
045    
046            protected JDataStoreDB() {
047                    super(TYPE_JDATASTORE);
048            }
049    
050            protected String getServerName() {
051                    return "jdatastore";
052            }
053    
054            protected String[] getTemplate() {
055                    return _JDATASTORE;
056            }
057    
058            private static String[] _JDATASTORE = {
059                    "--", "TRUE", "FALSE",
060                    "'1970-01-01'", "current_timestamp",
061                    " binary", " boolean", " date",
062                    " double", " integer", " bigint",
063                    " long varchar", " long varchar", " varchar",
064                    "", "commit"
065            };
066    
067            private static JDataStoreDB _instance = new JDataStoreDB();
068    
069    }