Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Regular Contributor
Posts: 65
Registered: ‎01-03-2013
My Device: 9810
My Carrier: Tmobile

how to insert json map data into local database (SQLITE) javascript

I have a json data which contant string, integer and map data type, i want to add the data into local database "SQLITE" i am not sure how to add the map data into local database and how to add string values into '',

this is the method i am using

get_json(                    server_url + api_url,"POST", jsonString,function(data){                        console.log("Server data&colon; "+ JSON.stringify(data));                        console.log("data.broadcasts.length : "+ data.broadcasts.length);                        var SQL ="";                        var fields ="";                        var values="";for(i =0; i < data.plugins.length; i++){                            console.log("============= plugines start =====================");                            var kk = data.plugins[i];for(var temp in kk){                                console.log("key: "+ temp +", plugin[key] : "+ kk[temp]);                                fields = fields + temp +",";values=values+ kk[temp]+",";}                            console.log("plugins fields: "+ fields);                            console.log("plugins values: "+values);                            fields = fields.substring(0, fields.length -1);//valulue1 =values.replace(values+"''");//console.log("yama "+valulue1);values=values.substring(0,values.length -1);                            SQL ="insert into plugin ("+ fields +") values ("+values+")";                            console.log("plugin sql is : "+ SQL);                            runSql(SQL);                            console.log("data inserted into plugin");}});
 the json data come as::plugin sql is:insertinto plugin (id,distributionTime,validFrom,validTo,cacheLocally,appName,name,icon,pluginURI)values(P0,1341489600000,1325376000000,1609372800000,[object Object],Fire Safety,FireSafety,[object Object],plugin).
both icon and cashelocally are map,someone please help
Please press the like button to thank the user that helped you.
Accept as a solution if it solved the problem.