Skip to content

Conversation

@alumni
Copy link
Collaborator

@alumni alumni commented Jun 19, 2025

Description of change

Fixes #10836, fixes #11534.

oracledb only allows reusing named parameters; bound parameters cannot be reused. Therefore the behavior before #10327 was correct for Oracle.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change

Summary by CodeRabbit

  • New Features

    • Added a new sample database configuration for the "sqljs" database type.
    • Introduced a new "Person" entity for testing purposes.
    • Added a functional test suite to verify handling of reused query parameters in the query builder.
  • Bug Fixes

    • Updated parameter handling for Oracle to ensure each parameter occurrence is treated independently.
  • Tests

    • Added tests for reused parameters in queries.
    • Updated SQLite parameter test descriptions for clarity.
    • Removed outdated tests and entity related to a previously reported GitHub issue.
  • Chores

    • Cleaned up and removed obsolete test files and entities.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

Walkthrough

A new SQL.js database configuration was added to the sample ORM config. The Oracle driver was updated so that reused query parameters are no longer deduplicated, resulting in each occurrence being assigned a new placeholder. New tests were added for reused query parameters, while an old test and entity related to parameter deduplication were removed.

Changes

File(s) Change Summary
ormconfig.sample.json Added a new "sqljs" database connection configuration object.
src/driver/oracle/OracleDriver.ts Removed deduplication logic for reused query parameters; each occurrence now gets a new placeholder.
test/functional/query-builder/parameters/entity/Person.ts Added new Person entity for testing.
test/functional/query-builder/parameters/reused-parameters.ts Added new tests for reused query parameters across multiple drivers.
test/functional/query-builder/parameters/sqlite-parameters.ts Reordered imports and updated test suite description for clarity; no logic changes.
test/github-issues/7308/entity/weather.ts, test/github-issues/7308/issue-7308.ts Deleted Weather entity and its associated test for parameter deduplication in query builder.

Sequence Diagram(s)

sequenceDiagram
    participant TestSuite as Test Suite
    participant QueryBuilder as Query Builder
    participant OracleDriver as Oracle Driver
    participant Database as Database

    TestSuite->>QueryBuilder: Build query with reused parameters
    QueryBuilder->>OracleDriver: Prepare SQL and parameters
    OracleDriver->>OracleDriver: Assign new placeholder for each parameter occurrence
    OracleDriver->>QueryBuilder: Return SQL and parameters
    QueryBuilder->>Database: Execute query
    Database-->>QueryBuilder: Return results
    QueryBuilder-->>TestSuite: Results and SQL/parameters for assertions
Loading

Suggested labels

driver: oracle, need review help, size-m

Suggested reviewers

  • naorpeled
  • gioboa

Poem

A hop and a skip through Oracle's den,
No more sharing placeholders again!
SQL.js joins the config crowd,
While new tests cheer and old ones bowed.
With every query parameter anew,
The rabbits say: "Clear and true!" 🐇

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-19T19_22_31_262Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7cbbfd6 and 788a2ae.

📒 Files selected for processing (7)
  • ormconfig.sample.json (1 hunks)
  • src/driver/oracle/OracleDriver.ts (1 hunks)
  • test/functional/query-builder/parameters/entity/Person.ts (1 hunks)
  • test/functional/query-builder/parameters/reused-parameters.ts (1 hunks)
  • test/functional/query-builder/parameters/sqlite-parameters.ts (1 hunks)
  • test/github-issues/7308/entity/weather.ts (0 hunks)
  • test/github-issues/7308/issue-7308.ts (0 hunks)
💤 Files with no reviewable changes (2)
  • test/github-issues/7308/issue-7308.ts
  • test/github-issues/7308/entity/weather.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/functional/query-builder/parameters/sqlite-parameters.ts
  • ormconfig.sample.json
  • test/functional/query-builder/parameters/reused-parameters.ts
  • src/driver/oracle/OracleDriver.ts
  • test/functional/query-builder/parameters/entity/Person.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: formatting
  • GitHub Check: build
  • GitHub Check: Release preview build
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 19, 2025

typeorm-sql-js-example

npm i https://pkg.pr.new/typeorm/typeorm@11537

commit: 788a2ae

@alumni alumni force-pushed the fix/oracle-duplicate-query-parameter branch from 7cbbfd6 to 788a2ae Compare June 19, 2025 19:21
@coveralls
Copy link

coveralls commented Jun 19, 2025

Coverage Status

coverage: 76.383% (-0.003%) from 76.386%
when pulling 788a2ae on alumni:fix/oracle-duplicate-query-parameter
into 1bcf055 on typeorm:master.

Copy link
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great 👍
Thank you @alumni you rock

@alumni alumni requested review from OSA413 and sgarner June 21, 2025 11:07
@alumni alumni merged commit f2d2236 into typeorm:master Jun 21, 2025
58 checks passed
@alumni alumni deleted the fix/oracle-duplicate-query-parameter branch June 22, 2025 14:30
ThbltLmr pushed a commit to ThbltLmr/typeorm that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ORA-01008: not all variables bound Parameter binding fails for Oracle query when parameter name is reused

4 participants