{"action":"created","issue":{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/355","repository_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage","labels_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/355/comments","events_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/355/events","html_url":"https://github.com/litehelpers/Cordova-sqlite-storage/issues/355","id":109492398,"number":355,"title":"Cannot call method 'transaction' of null","user":{"login":"lucascardoso","id":2519428,"avatar_url":"https://avatars.githubusercontent.com/u/2519428?v=3","gravatar_id":"","url":"https://api.github.com/users/lucascardoso","html_url":"https://github.com/lucascardoso","followers_url":"https://api.github.com/users/lucascardoso/followers","following_url":"https://api.github.com/users/lucascardoso/following{/other_user}","gists_url":"https://api.github.com/users/lucascardoso/gists{/gist_id}","starred_url":"https://api.github.com/users/lucascardoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucascardoso/subscriptions","organizations_url":"https://api.github.com/users/lucascardoso/orgs","repos_url":"https://api.github.com/users/lucascardoso/repos","events_url":"https://api.github.com/users/lucascardoso/events{/privacy}","received_events_url":"https://api.github.com/users/lucascardoso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/labels/documentation","name":"documentation","color":"006b75"},{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/labels/question","name":"question","color":"cc317c"},{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/labels/testing","name":"testing","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-02T13:38:06Z","updated_at":"2016-04-28T04:55:17Z","closed_at":"2015-12-24T01:32:37Z","body":"Hi guys, I'm having a problem when it comes to running a query in the database.\r\n\r\nthis is the query that is executed:\r\n> var query = \"SELECT email FROM usuarios WHERE email = ?\";\r\n  \t  var existe = false;\r\n      $cordovaSQLite.execute(db, query, [usuario]).then(function (res) {\r\n        if (res.rows.length > 0) {\r\n          existe = true;\r\n        } else {\r\n          console.log(\"Nenhum resultado encontrado.\");\r\n        }\r\n      }, function (err) {\r\n        console.error(err);\r\n      });\r\n> ##\r\nthis is the error I get:\r\n> D/SystemWebChromeClient(23723): file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 21157 : TypeError: Cannot call method 'transaction' of null\r\nD/SystemWebChromeClient(23723):     at Object.execute (file:///android_asset/www/lib/ngCordova/dist/ng-cordova.js:5960:12)\r\nD/SystemWebChromeClient(23723):     at findUsuario (file:///android_asset/www/js/servico.js:16:22)\r\nD/SystemWebChromeClient(23723):     at efetuarLogin (file:///android_asset/www/js/servico.js:37:13)\r\nD/SystemWebChromeClient(23723):     at Scope.$scope.login (file:///android_asset/www/js/controllers/controllers.js:55:47)\r\nD/SystemWebChromeClient(23723):     at fn (eval at <anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:1:0), <anonymous>:4:206)\r\nD/SystemWebChromeClient(23723):     at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:57514:9\r\nD/SystemWebChromeClient(23723):     at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:24673:28)\r\nD/SystemWebChromeClient(23723):     at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:24772:23)\r\nD/SystemWebChromeClient(23723):     at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:57513:13)\r\nD/SystemWebChromeClient(23723):     at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:12098:21)\r\nI/chromium(23723): [INFO:CONSOLE(21157)] \"TypeError: Cannot call method 'transaction' of null\r\nI/chromium(23723):     at Object.execute (file:///android_asset/www/lib/ngCordova/dist/ng-cordova.js:5960:12)\r\nI/chromium(23723):     at findUsuario (file:///android_asset/www/js/servico.js:16:22)\r\nI/chromium(23723):     at efetuarLogin (file:///android_asset/www/js/servico.js:37:13)\r\nI/chromium(23723):     at Scope.$scope.login (file:///android_asset/www/js/controllers/controllers.js:55:47)\r\nI/chromium(23723):     at fn (eval at <anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:1:0), <anonymous>:4:206)\r\nI/chromium(23723):     at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:57514:9\r\nI/chromium(23723):     at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:24673:28)\r\nI/chromium(23723):     at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:24772:23)\r\nI/chromium(23723):     at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:57513:13)\r\nI/chromium(23723):     at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:12098:21)\", source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (21157)\r\n> ##\r\n\r\nif anyone can help me right now thanks!"},"comment":{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/comments/215309872","html_url":"https://github.com/litehelpers/Cordova-sqlite-storage/issues/355#issuecomment-215309872","issue_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/355","id":215309872,"user":{"login":"swastikpareek","id":3340537,"avatar_url":"https://avatars.githubusercontent.com/u/3340537?v=3","gravatar_id":"","url":"https://api.github.com/users/swastikpareek","html_url":"https://github.com/swastikpareek","followers_url":"https://api.github.com/users/swastikpareek/followers","following_url":"https://api.github.com/users/swastikpareek/following{/other_user}","gists_url":"https://api.github.com/users/swastikpareek/gists{/gist_id}","starred_url":"https://api.github.com/users/swastikpareek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swastikpareek/subscriptions","organizations_url":"https://api.github.com/users/swastikpareek/orgs","repos_url":"https://api.github.com/users/swastikpareek/repos","events_url":"https://api.github.com/users/swastikpareek/events{/privacy}","received_events_url":"https://api.github.com/users/swastikpareek/received_events","type":"User","site_admin":false},"created_at":"2016-04-28T04:55:17Z","updated_at":"2016-04-28T04:55:17Z","body":"Hey . I was able to fix the bug . It was not related to any specific cordova plugin but the cordova version. \r\n\r\nI have recently upgraded my cordova version from 5.x.x to 6.x.x which was a break release (unfortunately) and openDB function which was initially taking database name as a whole and sole required parameter needed to have one more argument 'location' clubbed with database name as json .. \r\n\r\nDue to this upgradation to break release my db var was getting a null value; and hence this problem.\r\n\r\nSo $cordovaSQLite.openDB(\"myapp9.db\"); needed to be changed with $cordovaSQLite.openDB({name:\"myapp9.db\", location:'default'}); \r\n\r\nChanging this solved my problem."}}