pjfanning opened a new pull request, #1874:
URL: https://github.com/apache/pekko-connectors/pull/1874
**Motivation:**
`OrientDbSourceStage` validates `className` in its constructor
unconditionally, including when an explicit `query` is supplied. In that case
`className` is never used — `createLogic` ignores it in both `query = Some(q)`
branches, and the only statement that interpolates it is built when `query` is
empty:
```scala
client.query(s"SELECT * FROM $className SKIP ${skip} LIMIT
${settings.limit}")
```
Both DSLs require `className` as a positional argument
(`OrientDbSource(className, settings, query)`, `OrientDbSource.typed(className,
settings, clazz, query)`), so a caller reading purely by query must pass a
syntactically valid dummy class name to get past a check guarding a string
their query never reaches.
**Modification:**
Validate only when `query` is empty, which is exactly when `className` is
interpolated into the `SELECT`.
**Result:**
Query-only reads no longer need a placeholder class name. The injection
guard is unchanged wherever `className` actually reaches SQL.
**Tests:**
Extended `OrientDbSourceStageSpec` with stage-level tests, since the
conditional is on the stage rather than on `validateClassName`:
- an invalid class name is still rejected when no query is given
- a valid one is accepted when no query is given
- a class name that is empty, `null`, or malformed is accepted when a query
is given
Verified the query-mode test fails without this change. 11 tests pass. Ran
`orientdb/mimaReportBinaryIssues` (clean) and the module scalafmt checks.
**References:**
Follow-up to #1821.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]