Skip to main content

How To implement a sqlite database in phonegap

'm implementing a cross platform app for Android, iOS, and BlackBerry. I'm using PhoneGap to produce native language versions for each platform. I want to know how to create, access, and search a SQLite database.

I've read in the documentation that it can be created via a Javascript file but I want to know where to place that file & how to refrence it in the code.

Answer :

Take a look at Lawnchair (http://brian.io/lawnchair/), its pretty easy to use and out-of-the box probably does most of what you need (including searching), its cross-browser, battle tested and degrades nicely through the use of adapters. There is an adapter for Blackberry, and a plugin that support queries. Here is quick example using the webkit adapter, which is good for Android and iPhone, to show how simple it is.

<script type="text/javascript" src="Lawnchair.js" charset="utf-8"></script> <script type="text/javascript" src="webkit-sqlite.js" charset="utf-8"></script> // Open local DB connection var lawnchair = new Lawnchair({table:'mytable', adaptor:'webkit'}, function(){ // Lawnchair setup! }); // Getting some data out of the lawnchair database lawnchair.get('my_data_key', function(obj) { if (obj !== undefined) { lastSyncDate = obj.lastSync; dataList = obj.dataList; } }); // Saving to the database lawnchair.save({key:'my_data_key', lastSync: currentTime, dataList: someData});


Quoted by :



SISINDOTEK - IT Training & Solution Provider

Office 1 : Jl. Pelajar Pejuang 45 No.23 , Lt.2 Bandung - Jawa Barat

Office 2 : Jl. Sukasenang VI-6B Bandung - Jawa Barat 40124
Tel. 022-71242266, SMS. 0812.8733.1966
info , YM. sisindotek
www.sisindotek.com , facebook.com/sisindotek , twitter.com/sisindotek

Comments

Popular posts from this blog

SEO , Top Keyword Research 2015

Google's Hummingbird update created a lot of anxiety, but ultimately, it could be a good thing for the industry, because it frees us from the tyranny of competing for a limited number of top keywords. Essentially, the role of the Hummingbird algorithm is to better answer those longer-tail queries users are typing in Google. If your pages are optimized for these more conversational queries, you have a better chance of top rankings. Try a new, niche-based approach to keywords, which allows you to double or even triple the list of profitable keywords in your SEO arsenal. This article explains the four steps for doing keyword research the modern way, using SEO PowerSuite or other tools. 1. Ideas: Most search marketers simply think of the main keywords related to their businesses, plop them into a tool like Google Keyword Planner, and then run with the keyword list it delivers. However, search habits vary widely: Searchers may use hundreds of different word combinations to describe the ...

Training Search Engine Optimization (SEO) and Internet Marketing

PURNAMAACADEMY.com (0838-0838-0001) info Jadwal silabus : TRAINING SEARCH ENGINE OPTIMIZATION (SEO) AND INTERNET MARKETING (3 HARI), Kegiatan pelatihan/ training akan dilaksanakan selama 3 Hari, dengan pilihan lokasi Jakarta, Bandung , Surabaya, Yogya dan Bali. Purnama Academy Training (0838-0838-0001) merupakan salah satu penyelenggara training IT dan Manajemen terbaik di Bandung Jakarta Surabaya dan Bali serta beberapa kota lainnya, selain topik training diatas Anda juga bisa mengikuti beberapa pelatihan populer kami lainnya seperti Excel VBA Macro, Leadership, BUsiness Analisys , UML, Software Testing, Autocad, Google Map API, Power BI for Business User, ITIL foundation, COBIT 5 Foundation, Yii Framework, Laravel , Microsoft Project, Primavera dan Magento. Kegiatan Training tersedia atas 3 Paket (Full Day : 09.00 - 16.00, Night Class : 16.30 - 21.00, Weekend Class : 09.00 - 21.00). Hubungi tim Purnama Academy untuk informasi lebih detail terkait silabus, waktu pelaksanaan dan biaya...

TRAINING UNITY 3D GAME ADVANCED : WORKING WITH FIREBASE-BANDUNG

TRAINING UNITY 3D GAME ADVANCED : WORKING WITH FIREBASE By Purnama Academy - Training Center January 08, 2018  No comments UNITY 3D GAME ADVANCED : WORKING WITH FIREBASE www.purnamaacademy.com , Hotline (Call/SMS/WA) :  0838-0838-0001 Syllabus Overview Training yang membahas tingkatan lanjut dari pengembangan game 3D menggunakan UNITY 3D baik skala desktop ataupun mobile, dimana peserta mengetahui cara cara menyimpan informasi data game dari player ke dalam backend dengan bantuan firebase SDK, hal ini memungkinkan untuk pengembangan game skala jaringan (online) Class Type : Training Duration : 2 Days (09.00 – 17.00) Venue / Price : Click Here , Registration : Click Here  (Save up to 20% for Early Bird Registration !) Description : Firebase is Google's mobile platform that helps you quickly develop high-quality apps and grow your business A dependable backend is a must-have for today's games. Giving users the ability to log in and save and retrieve player data can make or...