This commit is contained in:
HaHaWTH 2024-02-03 19:07:48 +08:00
parent 2b0bee198e
commit e9810c69f4
2 changed files with 14 additions and 1 deletions

View File

@ -71,7 +71,7 @@ public class H2 extends AbstractSqlDataSource {
this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
this.col = new Columns(settings); this.col = new Columns(settings);
this.con = connection; this.con = connection;
this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings); this.columnsHandler = AuthMeColumnsHandler.createForH2(con, settings);
} }
/** /**

View File

@ -51,6 +51,19 @@ public final class AuthMeColumnsHandler {
return new AuthMeColumnsHandler(sqlColHandler); return new AuthMeColumnsHandler(sqlColHandler);
} }
public static AuthMeColumnsHandler createForH2(Connection connection, Settings settings) {
ColumnContext columnContext = new ColumnContext(settings, false);
String tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
String nameColumn = settings.getProperty(DatabaseSettings.MYSQL_COL_NAME);
SqlColumnsHandler<ColumnContext, String> sqlColHandler = new SqlColumnsHandler<>(
forSingleConnection(connection, tableName, nameColumn, columnContext)
.setPredicateSqlGenerator(new PredicateSqlGenerator<>(columnContext, false))
);
return new AuthMeColumnsHandler(sqlColHandler);
}
/** /**
* Creates a column handler for MySQL. * Creates a column handler for MySQL.
* *