You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(postgresql): eliminate duplicate _splitPostgresStatements in favor of SqlStatementSplitter #1517
In lib/features/postgresql/postgres_table_utils.dart (lines 66–109):
isAllowedPostgresSelectQuery relies on _splitPostgresStatements(sql), which creates multiple full-text masked copies of the SQL string:
List<String> _splitPostgresStatements(String sql) {
final masked =_maskPostgresComments(maskSqlLiteralsForLimitScan(sql));
final statements =<String>[];
var start =0;
for (var i =0; i < masked.length; i++) {
if (masked[i] ==';') {
statements.add(sql.substring(start, i));
start = i +1;
}
}
...
This duplicates the functionality already provided by the core SqlStatementSplitter (lib/core/database/sql_statement_splitter.dart), while generating 2 full-text string buffers and multiple unnecessary substring slices.
Proposed Solution
Replace _splitPostgresStatements(sql) with SqlStatementSplitter.spans(sql).
Remove private helper functions _splitPostgresStatements and _maskPostgresComments in postgres_table_utils.dart.
Acceptance Criteria
isAllowedPostgresSelectQuery uses SqlStatementSplitter.spans for statement boundary detection.
Over 40 lines of duplicate masking code are deleted.
Activity
Merge pull request #1605 from QueryaHub/issue/1517-postgres-split-sta…