Nano-SQL icon indicating copy to clipboard operation
Nano-SQL copied to clipboard

Cannot select a single (existing) row with where query

Open grupster opened this issue 5 years ago • 1 comments

Which version are you using? 2.3.7 in NodeJS v8.16.0

Describe the bug I first list all records on a table and get the expected results. Then I query for one record using a where clause and I get no results. Maybe I am doing something wrong.

Expected behavior I should get results for a simple where query.

Example 1. When I select all records: nSQL("files").query("select").exec().then((rows) => { console.log (rows) }) I get expected array of results: [ { id: '2bae6c1b-de70-4d48-b409-8e278801d817', fname: 'EC_DEMO1_20190912_csv', st: 'new', tsc: 1568305959880, size: 118, rows: 1 }, { id: '423c89c2-e6d2-4262-a83c-fd05f6fe53c8', fname: 'EC_DEMO1_20190912.csv', st: 'new', tsc: 1568305419114, size: 118, rows: 1 }, { id: '5012ea41-ef26-42b8-ab2e-ac3c250ad359', fname: 'EC_DEMO1_20190912.csv', st: 'new', tsc: 1568305448970, size: 118, rows: 1 }, { id: '7504a211-60ab-4c88-98b9-c3e2f9c9ef1b', fname: 'EC_DEMO1_20190912_csv', st: 'new', tsc: 1568305989676, size: 118, rows: 1 }, { id: 'f1190e36-595e-4401-a863-e03b82221358', fname: 'EC_DEMO1_20190912.csv', st: 'new', tsc: 1568305478908, size: 118, rows: 1 } ]

2. When I query using a equal clause I get no results, even though the possible matches (2) exist: nSQL("files").query("select").where(["fname","=","EC_DEMO1_20190912_csv"]).exec().then((rows) => { console.log (rows) })

I get no results: []

grupster avatar Sep 12 '19 21:09 grupster

Is fname indexed?

antonkatz avatar Dec 30 '19 22:12 antonkatz