Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to operate the database through phonegap

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to operate the database through phonegap, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Examples are as follows:

Database Example document.addEventListener ("deviceready", onDeviceReady, false); function onDeviceReady () {var db=window.openDatabase ("Test", "1.0", "Test", 200000); db.transaction (populateDB,errorDB,successDB) } / / initialize database data function populateDB (tx) {tx.executeSql ('DROP TABLE IF EXISTS test1'); tx.executeSql (' CREATE TABLE IF NOT EXISTS test1 (id unique,name)'); tx.executeSql ('INSERT INTO test1 (id,name) VALUES (1, "Tony")) Tx.executeSql ('INSERT INTO test1 (id,name) VALUES (2, "Bill")); tx.executeSql (' INSERT INTO test1 (id,name) VALUES (3, "Tony"));} / / query method function queryDB (tx) {tx.executeSql ('SELECT * FROM test1', [], querySuccess,errorDB) } / / callback for successful query function querySuccess (tx,results) {var len=results.rows.length; var status=document.getElementById ("status"); var string = "Rows:" + len+ "; for (var iTuno Teti

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report