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

Test with [undefined] as parameters #398

Open
brody4hire opened this issue Dec 23, 2015 · 0 comments
Open

Test with [undefined] as parameters #398

brody4hire opened this issue Dec 23, 2015 · 0 comments
Labels

Comments

@brody4hire
Copy link

driftyco/ionic2#770 which referenced #393 was fixed as follows in Ionic2 Typescript:

--- a/ionic/platform/storage/sql.ts
+++ b/ionic/platform/storage/sql.ts
@@ -96,7 +96,7 @@ export class SqlStorage extends StorageEngine {
    * @param {array} params the additional params to use for query placeholders
    * @return {Promise} that resolves or rejects with an object of the form { tx: Transaction, res: Result (or err)}
    */
-  query(query, ...params) {
+  query(query, params=[]) {
     return new Promise((resolve, reject) => {
       try {
         this._db.transaction((tx) => {

According to https://github.com/driftyco/ionic2/issues/770#issuecomment-165568393:

Looks like the underlying implementation is really sensitive about the number of arguments in the params array, and using ...params created an array with one undefined item: [undefined] when it should have been empty.

The plugin should handle this case by either treating it as an empty parameters array, i.e. [], or throwing an exception, and the behavior should be the same for all target platforms. I will add a test for this when I get a chance.

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

1 participant