-
Notifications
You must be signed in to change notification settings - Fork 82
Add Database Connector Docs #1880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds three new DB Connector documentation pages (overview, configuration reference, example) and updates site navigation to include the DB Connector section; documents connection/config parameters, supported operations, transaction examples, and a complete Order Management example with schema and sample requests. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant API
participant DBConnector
participant Database
Client->>API: GET /place_order?customerId&productId&quantity
API->>DBConnector: beginTransaction()
DBConnector->>Database: BEGIN TRANSACTION
API->>DBConnector: select (check stock)
DBConnector->>Database: SELECT ... FOR UPDATE
Database-->>DBConnector: stock result
DBConnector-->>API: stock info
alt stock sufficient
API->>DBConnector: insert Order
DBConnector->>Database: INSERT INTO Orders ...
API->>DBConnector: insert OrderItems
DBConnector->>Database: INSERT INTO OrderItems ...
API->>DBConnector: executeQuery (update product stock)
DBConnector->>Database: UPDATE Products ...
API->>DBConnector: commitTransaction()
DBConnector->>Database: COMMIT
DBConnector-->>API: success
API-->>Client: 200 OK (order placed)
else insufficient stock
API->>DBConnector: rollbackTransaction()
DBConnector->>Database: ROLLBACK
DBConnector-->>API: error
API-->>Client: 4xx (out of stock)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
🧹 Nitpick comments (3)
en/docs/reference/connectors/db-connector/db-connector-overview.md (2)
36-36: Use hyphen for compound adjective "open-source."When "open source" precedes a noun, it should be hyphenated. Apply this diff:
-As an open source project, WSO2 extensions welcome contributions from the community. +As an open-source project, WSO2 extensions welcome contributions from the community.
28-32: Reduce repetition by varying sentence structure.The first two bullets both begin with "DB Connector," creating a repetitive opening. Consider rewording one bullet to improve readability.
-* **[DB Connector Example]({{base_path}}/reference/connectors/db-connector/db-connector-example/)**: This example explains how to use the DB Connector to build a simple Order Management API, demonstrating query execution, data modification, and transaction management. +* **[DB Connector Example]({{base_path}}/reference/connectors/db-connector/db-connector-example/)**: Learn how to build a simple Order Management API using this connector, demonstrating query execution, data modification, and transaction management.en/docs/reference/connectors/db-connector/db-connector-example.md (1)
112-122: Reduce repetition in step instructions.Lines 112, 116, and 120 each begin with "Add," creating a repetitive pattern. Vary the sentence structure:
2. Add Select operation as below. <img src="{{base_path}}/assets/img/integrate/connectors/db/select-operation.png" title="Select Operation" width="800" alt="Select Operation"/> -3. Add filter to check the stock availability. +3. Filter for stock availability using a Filter mediator. <img src="{{base_path}}/assets/img/integrate/connectors/db/filter.png" title="Filter" width="800" alt="Filter"/> -4. Add Insert operation to the then flow. +4. In the then flow, add an Insert operation.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (12)
en/docs/assets/img/integrate/connectors/db-store.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/add-connection-details.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/add-connector.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/add-mysql-connection.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/add-query-param.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/begintransaction-operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/complete-flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/connector-operations.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/execute-query-operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/filter.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/insert-operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/db/select-operation.pngis excluded by!**/*.png
📒 Files selected for processing (4)
en/docs/reference/connectors/db-connector/db-connector-config.md(1 hunks)en/docs/reference/connectors/db-connector/db-connector-example.md(1 hunks)en/docs/reference/connectors/db-connector/db-connector-overview.md(1 hunks)en/mkdocs.yml(1 hunks)
🧰 Additional context used
🪛 LanguageTool
en/docs/reference/connectors/db-connector/db-connector-overview.md
[style] ~32-~32: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tion, and transaction management. * **[DB Connector Reference]({{base_path}}/refe...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~36-~36: Use a hyphen to join words.
Context: ...tions. ## How to contribute As an open source project, WSO2 extensions welcome ...
(QB_NEW_EN_HYPHEN)
en/docs/reference/connectors/db-connector/db-connector-example.md
[grammar] ~98-~98: Ensure spelling is correct
Context: ...ect "Select Local Driver" or "Add Maven Dependancy" options. For this example let's use the...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~116-~116: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...idth="800" alt="Select Operation"/> 3. Add filter to check the stock availability....
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~120-~120: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..."Filter" width="800" alt="Filter"/> 4. Add Insert operation to the then flow. ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🔇 Additional comments (3)
en/mkdocs.yml (1)
823-826: Navigation structure is correct and consistent.The DB Connector section is properly placed alphabetically after Microsoft Azure Storage and before MongoDB Connector, with all three documentation files correctly referenced. YAML indentation is consistent with surrounding connector entries.
en/docs/reference/connectors/db-connector/db-connector-config.md (1)
175-180: Verify isResultSet setting for UPDATE query in executeQuery operation.Line 180 sets
<isResultSet>true</isResultSet>for an UPDATE query. UPDATE statements typically do not return result sets—they return an update count. Consider whether this should befalse:<db.executeQuery configKey="DBCon1"> <query>UPDATE `products` SET `stock_quantity` = `stock_quantity` - ? WHERE product_id = ?</query> ... <isResultSet>true</isResultSet> <!-- Should this be false for UPDATE? -->en/docs/reference/connectors/db-connector/db-connector-example.md (1)
175-180: Verify isResultSet configuration for UPDATE statement.In the XML source (lines 175–187), the
executeQueryoperation contains an UPDATE statement but sets<isResultSet>true</isResultSet>on line 180. UPDATE queries typically do not return result sets. Please verify whether this should befalse.
en/docs/reference/connectors/db-connector/db-connector-config.md
Outdated
Show resolved
Hide resolved
en/docs/reference/connectors/db-connector/db-connector-config.md
Outdated
Show resolved
Hide resolved
en/docs/reference/connectors/db-connector/db-connector-config.md
Outdated
Show resolved
Hide resolved
en/docs/reference/connectors/db-connector/db-connector-config.md
Outdated
Show resolved
Hide resolved
en/docs/reference/connectors/db-connector/db-connector-example.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
en/docs/reference/connectors/db-connector/db-connector-example.md (1)
112-124: Reduce repetitive sentence starters for better readability.Lines 112, 116, and 120 begin successive steps with "Add," creating a repetitive rhythm. Varying the phrasing will improve clarity and flow.
Consider rephrasing as follows:
- 2. Add Select operation as below. + 2. Configure a Select operation as below. - 3. Add filter to check the stock availability. + 3. Insert a filter to check the stock availability. - 4. Add Insert operation to the then flow. + 4. Configure the Insert operation in the then flow.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
en/docs/reference/connectors/db-connector/db-connector-config.md(1 hunks)en/docs/reference/connectors/db-connector/db-connector-example.md(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- en/docs/reference/connectors/db-connector/db-connector-config.md
🧰 Additional context used
🪛 LanguageTool
en/docs/reference/connectors/db-connector/db-connector-example.md
[style] ~116-~116: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...idth="800" alt="Select Operation"/> 3. Add filter to check the stock availability....
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~120-~120: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..."Filter" width="800" alt="Filter"/> 4. Add Insert operation to the then flow. ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🔇 Additional comments (1)
en/docs/reference/connectors/db-connector/db-connector-example.md (1)
249-250: Clarify OrderItems table expectations.Line 249 mentions checking the
OrdersandOrderItemstables, but the XML configuration (line 164) only inserts into theOrderstable. The example doesn't explicitly createOrderItemsrecords. Please clarify whether:
- The example intentionally focuses only on
Orders, or- The XML should include an additional insert into
OrderItems(and the documentation should reflect that).
$Subject
db-connector-reduced.mov
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.