1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.dao.db;
16  
17  import com.liferay.portal.kernel.dao.db.DB;
18  import com.liferay.portal.kernel.util.StringUtil;
19  
20  import java.io.IOException;
21  
22  /**
23   * <a href="JDataStoreDB.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Alexander Chow
26   * @author Sandeep Soni
27   * @author Ganesh Ram
28   */
29  public class JDataStoreDB extends FirebirdDB {
30  
31      public static DB getInstance() {
32          return _instance;
33      }
34  
35      public String buildSQL(String template) throws IOException {
36          template = convertTimestamp(template);
37          template = replaceTemplate(template, getTemplate());
38  
39          template = reword(template);
40          template = StringUtil.replace(
41              template,
42              new String[] {"\\'", "\\\"", "\\\\",  "\\n", "\\r"},
43              new String[] {"''", "\"", "\\", "\n", "\r"});
44  
45          return template;
46      }
47  
48      protected JDataStoreDB() {
49          super(TYPE_JDATASTORE);
50      }
51  
52      protected String getServerName() {
53          return "jdatastore";
54      }
55  
56      protected String[] getTemplate() {
57          return _JDATASTORE;
58      }
59  
60      private static String[] _JDATASTORE = {
61          "--", "TRUE", "FALSE",
62          "'1970-01-01'", "current_timestamp",
63          " binary", " boolean", " date",
64          " double", " integer", " bigint",
65          " long varchar", " long varchar", " varchar",
66          "", "commit"
67      };
68  
69      private static JDataStoreDB _instance = new JDataStoreDB();
70  
71  }