/** * Creates new <code>Cache71Dialect</code> instance. Sets up the JDBC / * Caché type mappings. */ public Cache71Dialect() { super(); commonRegistration(); register71Functions(); this.limitHandler = new TopLimitHandler( true, true ); }
@Override public String processSql(String sql, RowSelection selection) { if (LimitHelper.hasFirstRow( selection )) { throw new UnsupportedOperationException( "query result offset is not supported" ); } final int selectIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select" ); final int selectDistinctIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select distinct" ); final int insertionPoint = selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6); StringBuilder sb = new StringBuilder( sql.length() + 8 ) .append( sql ); if ( supportsVariableLimit ) { sb.insert( insertionPoint, " TOP ? " ); } else { sb.insert( insertionPoint, " TOP " + getMaxOrLimit( selection ) + " " ); } return sb.toString(); } }
/** * Constructs a SQLServerDialect */ public SQLServerDialect() { registerColumnType( Types.VARBINARY, "image" ); registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" ); registerColumnType( Types.LONGVARBINARY, "image" ); registerColumnType( Types.LONGVARCHAR, "text" ); registerColumnType( Types.BOOLEAN, "bit" ); registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(second, ?1)" ) ); registerFunction( "minute", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(minute, ?1)" ) ); registerFunction( "hour", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(hour, ?1)" ) ); registerFunction( "locate", new StandardSQLFunction( "charindex", StandardBasicTypes.INTEGER ) ); registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(?1, ?3)" ) ); registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1 % ?2" ) ); registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datalength(?1) * 8" ) ); registerFunction( "trim", new AnsiTrimEmulationFunction() ); registerKeyword( "top" ); registerKeyword( "key" ); this.limitHandler = new TopLimitHandler( false, false ); }
@Override public String processSql(String sql, RowSelection selection) { if (LimitHelper.hasFirstRow( selection )) { throw new UnsupportedOperationException( "query result offset is not supported" ); } final int selectIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select" ); final int selectDistinctIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select distinct" ); final int insertionPoint = selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6); StringBuilder sb = new StringBuilder( sql.length() + 8 ) .append( sql ); if ( supportsVariableLimit ) { sb.insert( insertionPoint, " TOP ? " ); } else { sb.insert( insertionPoint, " TOP " + getMaxOrLimit( selection ) + " " ); } return sb.toString(); } }
/** * Creates new <code>Cache71Dialect</code> instance. Sets up the JDBC / * Caché type mappings. */ public Cache71Dialect() { super(); commonRegistration(); this.limitHandler = new TopLimitHandler( true, true ); }
/** * Constructs a SQLServerDialect */ public SQLServerDialect() { registerColumnType( Types.VARBINARY, "image" ); registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" ); registerColumnType( Types.LONGVARBINARY, "image" ); registerColumnType( Types.LONGVARCHAR, "text" ); registerColumnType( Types.BOOLEAN, "bit" ); registerKeyword( "top" ); registerKeyword( "key" ); this.limitHandler = new TopLimitHandler( false, false ); }