001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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 final String[] _JDATASTORE = {
062                    "--", "TRUE", "FALSE", "'1970-01-01'", "current_timestamp", " binary",
063                    " binary", " boolean", " date", " double", " integer", " bigint",
064                    " long varchar", " long varchar", " varchar", "", "commit"
065            };
066    
067            private static JDataStoreDB _instance = new JDataStoreDB();
068    
069    }