Skip to content

Commit

Permalink
#550 fix the special case for procedure parameters reading (#1130)
Browse files Browse the repository at this point in the history
* #550 fix the special case for procedure parameters reading - then catalog or schema are quoted

* #550 formatting fix

* #550 add nullability check to the condition
  • Loading branch information
LonwoLonwo authored Dec 3, 2022
1 parent 8685008 commit 66c6c0d
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1140,17 +1140,29 @@ public ResultSet getProcedureColumns(
String procedureNameUnparsed = resultSetStepOne.getString("arguments").trim();
String procedureNameNoArgs = resultSetStepOne.getString("name");
String schemaName = resultSetStepOne.getString("schema_name");
// Check that schema name match the original input
// And check special case - schema with special name in quotes
boolean isSchemaNameMatch =
compiledSchemaPattern != null
&& (compiledSchemaPattern.matcher(schemaName).matches()
|| (schemaName.startsWith("\"")
&& schemaName.endsWith("\"")
&& compiledSchemaPattern
.matcher(schemaName)
.region(1, schemaName.length() - 1)
.matches()));

// Check that procedure name and schema name match the original input in case wildcards have
// been used.
// Procedure name column check must occur later when columns are parsed.
if ((compiledProcedurePattern != null
&& !compiledProcedurePattern.matcher(procedureNameNoArgs).matches())
|| (compiledSchemaPattern != null
&& !compiledSchemaPattern.matcher(schemaName).matches())) {
|| (compiledSchemaPattern != null && !isSchemaNameMatch)) {
continue;
}
String catalogName = resultSetStepOne.getString("catalog_name");
String showProcedureColCommand =
getSecondResultSetCommand(catalog, schemaName, procedureNameUnparsed, "procedure");
getSecondResultSetCommand(catalogName, schemaName, procedureNameUnparsed, "procedure");

ResultSet resultSetStepTwo =
executeAndReturnEmptyResultIfNotFound(
Expand Down

0 comments on commit 66c6c0d

Please sign in to comment.