GUACAMOLE-1253: Update select all queries to process in batches.

This commit is contained in:
Alex Leitner
2023-03-30 15:01:10 +00:00
committed by Mike Jumper
parent 7e38a089cf
commit 2708a205d3
8 changed files with 143 additions and 15 deletions

View File

@@ -88,6 +88,17 @@ public class SQLServerEnvironment extends JDBCEnvironment {
*/
public static final SQLServerDriver SQLSERVER_DEFAULT_DRIVER = SQLServerDriver.MICROSOFT_2005;
/**
* The default maximum number of identifiers/parameters to be included in a
* single batch when executing SQL statements for SQL Server.
*
* SQL Server supports a maximum of 2100 parameters per query. A value of
* 1000 is chosen to stay within this limit and avoid query execution errors.
*
* @see https://docs.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server
*/
private static final int DEFAULT_BATCH_SIZE = 1000;
/**
* Constructs a new SQLServerEnvironment, providing access to SQLServer-specific
* configuration options.
@@ -117,6 +128,13 @@ public class SQLServerEnvironment extends JDBCEnvironment {
DEFAULT_ABSOLUTE_MAX_CONNECTIONS
);
}
@Override
public int getBatchSize() throws GuacamoleException {
return getProperty(SQLServerGuacamoleProperties.SQLSERVER_BATCH_SIZE,
DEFAULT_BATCH_SIZE
);
}
@Override
public int getDefaultMaxConnections() throws GuacamoleException {

View File

@@ -206,5 +206,17 @@ public class SQLServerGuacamoleProperties {
public String getName() { return "sqlserver-auto-create-accounts"; }
};
/**
* The maximum number of identifiers/parameters to be included in a single batch when
* executing SQL statements.
*/
public static final IntegerGuacamoleProperty SQLSERVER_BATCH_SIZE =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-batch-size"; }
};
}