Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite sqlBatch type checking is wrong #1596

Closed
MichaelFedora opened this issue May 22, 2017 · 2 comments
Closed

SQLite sqlBatch type checking is wrong #1596

MichaelFedora opened this issue May 22, 2017 · 2 comments
Labels

Comments

@MichaelFedora
Copy link

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Current behavior:

Currently this is what the type-checking checks for:

/**
 * @param sqlStatements {Array<string | string[]>}
 * @returns {Promise<any>}
 */
 @CordovaInstance()
 sqlBatch(sqlStatements: Array<string | string[]>): Promise<any> { return; }

Expected behavior:

However, this is what it should be:

/**
 * @param sqlStatements {Array<string | [ string, any[] ]>}
 * @returns {Promise<any>}
 */
 @CordovaInstance()
 sqlBatch(sqlStatements: Array<string | [ string, any[] ]>): Promise<any> { return; }

Steps to reproduce:

You can check the official plugin repo source/test script here to verify what I said was correct: https://github.com/litehelpers/Cordova-sqlite-storage/blob/storage-master/spec/www/spec/sql-batch-test.js

i.e.:

db.sqlBatch([
  'DROP TABLE IF EXISTS MyTable',
  'CREATE TABLE MyTable (data)',
  [ 'INSERT INTO MyTable VALUES (?)', [101] ],
  [ 'INSERT INTO MyTable VALUES (?)', [-101] ],
  [ 'INSERT INTO MyTable VALUES (?)', [123.456] ],
  [ 'INSERT INTO MyTable VALUES (?)', [-123.456] ],
  [ 'INSERT INTO MyTable VALUES (?)', [1234567890123] ],
  [ 'INSERT INTO MyTable VALUES (?)', [-1234567890123] ],
  [ 'INSERT INTO MyTable VALUES (?)', [0] ],
], function() { /* ... */ }

Other information:

package.json info:

"@ionic-native/sqlite": "3.10.3"
ihadeed added a commit that referenced this issue Jul 10, 2017
BuddyLReno pushed a commit to BuddyLReno/ionic-native that referenced this issue Aug 28, 2017
@arsenk01
Copy link

arsenk01 commented Oct 9, 2017

Does this fix included in 3.12.1 version?

@MichaelFedora
Copy link
Author

This was closed in version 4.0.0 according to the Changelog.

(technically it was a lazy fix because it was just made into an any[] type instead of the correct Array<string | [ string, any[] ]>, but it still fixed it failing to compile).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants