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.tools.samplesqlbuilder; 016 017 import com.liferay.portal.dao.db.MySQLDB; 018 import com.liferay.portal.kernel.util.StringUtil; 019 020 /** 021 * A simplified version of MySQLDB for sample SQL generation. This should not be 022 * used for any other purposes. 023 * 024 * @author Shuyang Zhou 025 */ 026 public class SampleMySQLDB extends MySQLDB { 027 028 @Override 029 public String buildSQL(String template) { 030 return StringUtil.replace(template, _GENERIC_TEMPLATE, _MYSQL_TEMPLATE); 031 } 032 033 private static final String[] _GENERIC_TEMPLATE = { 034 "TRUE", "FALSE", "'01/01/1970'", "CURRENT_TIMESTAMP", 035 "COMMIT_TRANSACTION" 036 }; 037 038 private static final String[] _MYSQL_TEMPLATE = { 039 "1", "0", "'1970-01-01'", "now()", "commit" 040 }; 041 042 }