ujjwalguptaofficial / JsStore

Simplifying IndexedDB with SQL like syntax and promises
http://jsstore.net/
MIT License
858 stars 110 forks source link

Timestamp Concatenate and String Comparison Not Working #358

Closed Aparnai7 closed 10 months ago

Aparnai7 commented 11 months ago

Title

Timestamp Concatenate and String Comparison Not Working

Description

// Issue #1 Timestamp Concatenate Issue

I want to compare timestamp in a join with where condition ;

I have two columns in table (startDate and startTime) used in join and I want to convert them into timestamp() then compare with incoming datetime values.

E.g

datetime(p1.startDate,p1.startShiftTime):{ '<=':datetime(p1.startDate,p1.startShiftTime) } Please provide the syntax to do the same.

// Issue #2

String comparison is not working using comparison operators. Ex.

select({ from: "Orders", join: [{ type: "inner", with: 'Customers', on: 'Orders.customerId=Customers.customerId', where: { orderDate: { '<=': '1996-11-06T00:00:00.000Z' }, }, }, ], });

ujjwalguptaofficial commented 11 months ago

Issue 1

Use transaction api to do some calculation on datas and then filter it.

https://jsstore.net/docs/transaction

Issue 2

If your order date is not saved as string, then string comparision won't work. If your order date is saved as date object, then pass date object.

ujjwalguptaofficial commented 10 months ago

@Aparnai7 let me know if needs help - I am OK to hop on a call and help you.

Aparnai7 commented 10 months ago

@ujjwalguptaofficial I have checked the transaction api, it may not resolve my issue as I required to use multiple datetime comparison in my sql query. Hopping on a quick call is a good idea, will send a DM on your mail.