Have any questions?
+44 1234 567 890
Appendix A. AddFirebirdSupport.groovy
A. AddFirebirdSupport.groovy
package databasehelper; import net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper; import net.datenwerke.rs.base.service.dbhelper.DatabaseHelper import net.datenwerke.rs.base.service.dbhelper.hooks.DatabaseHelperProviderHook import net.datenwerke.rs.base.service.dbhelper.queries.LimitQuery import net.datenwerke.rs.base.service.dbhelper.queries.OffsetQuery import net.datenwerke.rs.base.service.dbhelper.queries.Query import net.datenwerke.rs.base.service.dbhelper.querybuilder.ColumnNamingService import net.datenwerke.rs.base.service.dbhelper.querybuilder.QueryBuilder class Firebird extends DatabaseHelper { public static final String DB_NAME = "Firebird"; public static final String DB_DRIVER = "org.firebirdsql.jdbc.FBDriver"; public static final String DB_DESCRIPTOR = "DBHelper_Firebird"; @Override public String getDescriptor() { return DB_DESCRIPTOR; } @Override public String getDriver() { return DB_DRIVER; } @Override public String getName() { return DB_NAME; } @Override public LimitQuery getNewLimitQuery(Query nestedQuery, QueryBuilder queryBuilder) { return new LimitQuery(nestedQuery, queryBuilder){ @Override public void appendToBuffer(StringBuffer buf) { buf.append("SELECT FIRST "); buf.append(queryBuilder.getLimit()); buf.append(" * FROM ("); nestedQuery.appendToBuffer(buf); buf.append(") limitQry"); } } } @Override public OffsetQuery getNewOffsetQuery(Query nestedQuery, QueryBuilder queryBuilder, ColumnNamingService columnNamingService) { return new OffsetQuery(nestedQuery, queryBuilder, columnNamingService){ @Override public void appendToBuffer(StringBuffer buf) { buf.append("SELECT FIRST "); buf.append(queryBuilder.getLimit()); buf.append(" SKIP "); buf.append(queryBuilder.getOffset()); buf.append(" * FROM ("); nestedQuery.appendToBuffer(buf); buf.append(") limitQry"); } } } } def HOOK_NAME = "DATASOURCE_HELPER_FIREBIRD" def callback = [ provideDatabaseHelpers : { return Collections.singletonList(new Firebird()); } ] as DatabaseHelperProviderHook; GLOBALS.services.callbackRegistry.attachHook(HOOK_NAME, DatabaseHelperProviderHook.class, callback)