Cordova-sqlite-storage: sqlite3_prepare_v2 failure: near "group": syntax error on android

Created on 14 Jun 2017  路  2Comments  路  Source: storesafe/cordova-sqlite-storage

Service.js

InsertInToGroup: function(param) {
var deferred = $q.defer();
var promise = deferred.promise;
$cordovaSQLite.execute(db, "INSERT INTO group (title, about_group, category_id, pic, status, del) VALUES (?, ?, ?, ?, ?, ?);", [param.title, param.about_group, parseInt(param.category_id), param.pic, 0, false])
.then(function(res) {
deferred.resolve(res);
}, function(err){
deferred.reject(err);
});
promise.success = function (fn) {
promise.then(fn);
return promise;
}
promise.error = function (fn) {
promise.then(null, fn);
return promise;
}
return promise;
}

I have consumed InsertInToGroup service function to create group. but it's throwing below error
err = Object {message: "sqlite3_prepare_v2 failure: near "group": syntax error", code: 0}

Plugin Installed
ionic plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git#0.7.14
Ionic Version 2.2.2

Please help me to find out the issue

invalid question doc-todo doc-pitfall angular

Most helpful comment

The problem is that group is a keyword. If you really have a table called group the workaround is to put single quotes or double quotes around it.

All 2 comments

The problem is that group is a keyword. If you really have a table called group the workaround is to put single quotes or double quotes around it.

thanks man, you save my day

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reconka picture reconka  路  5Comments

jreynerio picture jreynerio  路  5Comments

PterPmnta picture PterPmnta  路  4Comments

agnosco picture agnosco  路  5Comments

TommyQu picture TommyQu  路  4Comments