Skip to content

Commit

Permalink
Merge pull request #1085 from daneshk/main
Browse files Browse the repository at this point in the history
Change the compiler validation to support disabling PS cache
  • Loading branch information
daneshk authored Nov 11, 2024
2 parents b95a9d8 + e1c9191 commit 146939b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "sql"
version = "1.14.0"
version = "1.14.1"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ public void testPostgreSQLOptionRecord() {

for (int i = 0; i < diagnosticErrorStream.size(); i++) {
Diagnostic diagnostic = diagnosticErrorStream.get(i);
if (i <= 7) {
Assert.assertEquals(diagnostic.diagnosticInfo().code(), POSTGRESQL_101.getCode());
Assert.assertEquals(diagnostic.diagnosticInfo().messageFormat(),
POSTGRESQL_101.getMessage());
} else {
if (8 <= i && i <= 10) {
Assert.assertEquals(diagnostic.diagnosticInfo().code(), POSTGRESQL_102.getCode());
Assert.assertEquals(diagnostic.diagnosticInfo().messageFormat(),
POSTGRESQL_102.getMessage());
} else {
Assert.assertEquals(diagnostic.diagnosticInfo().code(), POSTGRESQL_101.getCode());
Assert.assertEquals(diagnostic.diagnosticInfo().messageFormat(),
POSTGRESQL_101.getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ public static void validateOptions(SyntaxNodeAnalysisContext ctx, String name, E
case Constants.Options.ROW_FETCH_SIZE:
case Constants.Options.CACHED_METADATA_FIELD_COUNT:
case Constants.Options.CACHED_METADATA_FIELD_SIZE:
case Constants.Options.PREPARED_STATEMENT_THRESHOLD:
case Constants.Options.PREPARED_STATEMENT_CACHE_QUERIES:
case Constants.Options.PREPARED_STATEMENT_CACHE_SIZE_MIB:
int sizeVal = Integer.parseInt(getTerminalNodeValue(valueNode, "1"));
if (sizeVal <= 0) {
DiagnosticInfo diagnosticInfo = new DiagnosticInfo(POSTGRESQL_102.getCode(),
Expand All @@ -164,6 +161,17 @@ public static void validateOptions(SyntaxNodeAnalysisContext ctx, String name, E
DiagnosticFactory.createDiagnostic(diagnosticInfo, valueNode.location()));
}
break;
case Constants.Options.PREPARED_STATEMENT_THRESHOLD:
case Constants.Options.PREPARED_STATEMENT_CACHE_QUERIES:
case Constants.Options.PREPARED_STATEMENT_CACHE_SIZE_MIB:
int thresholdVal = Integer.parseInt(getTerminalNodeValue(valueNode, "0"));
if (thresholdVal < 0) {
DiagnosticInfo diagnosticInfo = new DiagnosticInfo(POSTGRESQL_101.getCode(),
POSTGRESQL_101.getMessage(), POSTGRESQL_101.getSeverity());
ctx.reportDiagnostic(
DiagnosticFactory.createDiagnostic(diagnosticInfo, valueNode.location()));
}
break;
default:
// Can ignore all the other fields
}
Expand Down

0 comments on commit 146939b

Please sign in to comment.