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

Error on drop database and table

Open gsustalo opened this issue 4 years ago • 5 comments

Which version are you using? 2.3.7

Describe the bug Dropping tables always return next error:

core.js:9110 ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'count' of undefined

Dropping databases always return next error:

Error: TypeError: Cannot read property 'pkCol' of undefined

Tables are not dropped really in IndexedDB storage. Wherever, when query 'show tables' is submmited, this tables don't are returned

Example nSQL().dropDatabase("my_db").then(() => { // never }).catch(() => { // ALWAYS!! })

    nSQL('users')
      .query('drop')
      .exec()
      .then(() => {
    // never
}).catch(() => {
    // ALWAYS!! 
})`

gsustalo avatar Jan 23 '20 10:01 gsustalo

I've seen something similar.

Which adapter (or value of mode in db config) are you using?

m11m avatar Feb 03 '20 22:02 m11m

I'm using 'PERM' mode. Just like in: https://nanosql.io/databases.html#creating-a-database

gsustalo avatar Feb 04 '20 07:02 gsustalo

Hi! Did you get any far with this? I'm using 'TEMP' and seeing it as well.

patowazhir avatar Feb 07 '20 21:02 patowazhir

To be more specific, seeing it when dropping a table: await nSQL(this.tableName).query('drop').exec();

patowazhir avatar Feb 07 '20 22:02 patowazhir

Update: Ok I've had a closer look at my code and I'm not actually using 'drop' after all because it didn't (possibly still doesn't) delete indexes. I'm using 'delete' instead to delete all rows in the table. ++++ No problems using 'drop' in my application. result = await nSQL( this.dbTableName )).query( 'drop' ).exec()

You could try rebuilding indexes. const result = await nSQL( this.dbTableName ).query( 'rebuild indexes' ).exec()

nevf avatar Feb 16 '20 08:02 nevf