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

Sewa Ruang Meeting Daerah Citarum Bandung

Sewa ruang meeting kantor, training di Bandung Hubungi 0816-4038-78. Lokasi Ruang Meeting berada di Jl.Pelajar Pejuang 45 No.23B 1. Paket per Jam      - Biaya : Rp.50.000 / org / jam     - Fasilitas : Snack & Drink 2. Paket Half-Day     - Waktu : 09.00 s/d 13.00 Wib     - Biaya : Rp.120.000 / org      - Fasilitas : Makan siang 1x, Snack & Drink 3. Paket Full Day     - Waktu : 09.00 s/d 16.00 Wib     - Biaya : Rp.170.000 / org      - Fasilitas : Makan siang 1x, Coffe break 2x, Snack & Drink 4. Lain-lain     - Sewa Proyektor : Rp.150.000/day     - Extra time : Rp.100.000/Jam Syarat dan Ketentuan : 1. Min. 3org dan Max. 7org 2. Pembayaran H-3 sebelum tgl pelaksanaan 3. Melebihi jam ketentuan dikenakan biaya tambahan Sewa Ruang Meeting Daerah Citarum Bandung Hubungi 0816-4038-78 Ruang meeting murah mulai 50.000 di Buah Batu, Pasteur, Sukajadi, Lengkong, Antapani, Uj...

TRAINING PROJECT MANAGEMENT WITH PRIMAVERA P6-BANDUNG

TRAINING PROJECT MANAGEMENT WITH PRIMAVERA P6 By Purnama Academy - Training Center January 11, 2018  No comments PROJECT MANAGEMENT WITH PRIMAVERA P6 Syllabus Overview PRIMAVERA P6 adalah project management tool yang sangat populer digunakan hampir di perusahan perusahaan skala internasional dan multinasional yang sedang menjalankan project skala besar, lisensi atas PRIMAVERA P6 kini dimiliki oleh Vendor Oracle dan database yang disupport Primavera adalah SQL Server dan Oracle database. Sebagai sebuah software Project Tool skala enterprise maka Primavera memiliki 2 module di dalamnya yaitu (Methodology dan Project Management) Class Type : Training Duration : 4 Days (09.00 – 17.00) Venue  & Price : Click Here , Registration : Click Here  (Save up to 20% for Early Bird Registration !) Detail Syllabus or request for inhouse training  please contact Purnama Academy sales team info@purnamaacademy.com , Hotline (Call/SMS/Whatsapp) : 0838-0838-0001 Speaker  : Purn...