001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2009-2009 Pentaho and others 008// All Rights Reserved. 009*/ 010package mondrian.spi.impl; 011 012import mondrian.olap.Util; 013 014import java.sql.*; 015import java.util.List; 016 017/** 018 * Implementation of {@link mondrian.spi.Dialect} for the Hsqldb database. 019 * 020 * @author wgorman 021 * @since Aug 20, 2009 022 */ 023public class HsqldbDialect extends JdbcDialectImpl { 024 025 public static final JdbcDialectFactory FACTORY = 026 new JdbcDialectFactory( 027 HsqldbDialect.class, 028 DatabaseProduct.HSQLDB); 029 030 /** 031 * Creates a FirebirdDialect. 032 * 033 * @param connection Connection 034 */ 035 public HsqldbDialect(Connection connection) throws SQLException { 036 super(connection); 037 } 038 039 protected void quoteDateLiteral( 040 StringBuilder buf, 041 String value, 042 Date date) 043 { 044 // Hsqldb accepts '2008-01-23' but not SQL:2003 format. 045 Util.singleQuoteString(value, buf); 046 } 047 048 public String generateInline( 049 List<String> columnNames, 050 List<String> columnTypes, 051 List<String[]> valueList) 052 { 053 // Fall back to using the FoodMart 'days' table, because 054 // HQLDB's SQL has no way to generate values not from a table. 055 // (Same as Access.) 056 return generateInlineGeneric( 057 columnNames, columnTypes, valueList, 058 " from \"days\" where \"day\" = 1", false); 059 } 060} 061 062// End HsqldbDialect.java