initial version to make BusinessBase compatible with multiple adaptes and support for concatenated-columns#176
Open
durlabhjain wants to merge 3 commits into
Open
Conversation
…s and support for concatenated-columns
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces early multi-database adapter support in BusinessBase (by routing through a DB adapter instance) and adds initial support for “concatenated columns” in list results and filters.
Changes:
- Added adapter-level paging helpers (
addPaging) for SQL Server and MySQL. - Refactored
BusinessBaseto use an adapter getter and added support forqueryFileName-driven list statements. - Added a new
ConcatenatedColumnshelper and integrated it intoBusinessBase.list()(for filtering and for populating concatenated fields).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| lib/sql.js | Adds Sql.addPaging() helper for MSSQL pagination. |
| lib/mysql.js | Adjusts MySQL runQuery() return shape and adds Mysql.addPaging(). |
| lib/business/concatenated-columns.mjs | New helper to populate concatenated columns and generate subquery filters. |
| lib/business/business-base.mjs | Routes through adapter instance, adds queryFileName, concatenated-columns filtering and post-processing, and uses adapter paging. |
| @@ -819,8 +833,39 @@ class BusinessBase { | |||
| } | |||
| if (whereArr.length) { | |||
| whereArr.forEach((ele) => { | |||
Comment on lines
+857
to
+865
| where[`filter_${index}`] = { | ||
| statement: ConcatenatedColumns.applyStringFilter({ | ||
| value: filterValue.value, | ||
| concatenatedColumn, | ||
| request, | ||
| paramName, | ||
| operator: filterValue.operator | ||
| }) | ||
| }; |
| if (listResult.records?.length && concatenatedColumns.length) { | ||
| const resultValue = await ConcatenatedColumns.addColumns({ records: listResult.records, sql, columns: concatenatedColumns }); | ||
| if (resultValue !== null && resultValue !== undefined) { | ||
| listResult.records = resultValue.recordset; |
Comment on lines
679
to
681
| const result = await request.query(lookupListStatement); | ||
| return result.recordset; | ||
| } |
Comment on lines
+308
to
311
| const sql = this.getDatabaseAdapter(); | ||
| const request = sql.createRequest(); | ||
|
|
||
| query = sql.addParameters({ query, request, parameters: where, forWhere: true }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.