ujjwalguptaofficial / JsStore

A complete IndexedDB wrapper with SQL like syntax.
http://jsstore.net/
MIT License
849 stars 109 forks source link

Behavior of the "skip" for multiple columns in "or" operator in where clause #301

Closed ujjwalguptaofficial closed 1 year ago

ujjwalguptaofficial commented 1 year ago

Discussed in https://github.com/ujjwalguptaofficial/JsStore/discussions/300

Originally posted by **alisabrigok** October 11, 2022 When I query having multiple columns in "or" operator in the where clause, and if I use "skip", then "skip" gets applied to results of the all columns. Explaining by example using IDBStudio with demo database: Below returns 14 results; - 2 rows belong to customerId 81 - 1 row belongs to orderId 10256 - 11 rows belong to employeeId 5 ``` { select({ from: "Orders", where: { employeeId: 5, or: { customerId: 81, orderId: 10256, }, }, }) } ``` If I apply "skip: 1" to this exact query as above, then it returns 11 results. But I was expecting it to return 13 results because I just wanted to skip 1 row. Is my expectation correct here? Here I see that each of the columns loses a row due to the applied skip; - 1 row left from customerId 81 - No row left from orderId 10256 - 10 rows left from employeeId 5 ``` { select({ from: "Orders", where: { employeeId: 5, or: { customerId: 81, orderId: 10256, }, }, skip: 1 }) } ``` So skip here is applied to the records related to all of the columns. Do you think this Is an expected behavior or is this a bug? @ujjwalguptaofficial Thanks for all the help.
ujjwalguptaofficial commented 1 year ago

fixed the issue in v - 4.4.6