Websql Query Tool

Source: Internet
Author: User

Recently in writing Websql, every time in the browser console to execute SQL too laborious, and the brain is not good, always forget what the last initialized database, so wrote a very simple websql visualization tool, said the tool is a bit large, is to facilitate, today shared out, the need of classmates, Please take away, did not do too much logic judgment, have the question can reply me, I again to revise, do not spray ~ ~

I. Description

1. INSERT

Support multiple Insert statements, with "#" split, the last sentence does not add:,

INSERT into Student (id,name) VALUES (1, "Zhangsan"), #INSERT into Student (id,name) VALUES (2, "Lisi"); #INSERT into Student ( Id,name) VALUES (3, "Wangwu");

2, delete, modify, query according to normal SQL writing can be.

Second, the source code

var Dataprovider = (function () {function Dataprovider () {} DataProvider.prototype.init = function () {This.provider =  OpenDatabase (' madidb ', ' 1.0 ', ' MaDI DB ', 2 * 1024 * 1024);  };      DATAPROVIDER.PROTOTYPE.EXECUTESQL = function (sql) {var data = $ ("Result_data"); var nt = "*******************************************************************************************************      <br/> ";                This.provider.transaction (function (context) {Context.executesql (Sql,[],function (context,results) {                    if (results.rows.length>0) {for (var i = 0,len = results.rows.length;i<len;i++) {                  data.innerhtml + = Json.stringify (Results.rows[i]) + "<br/>"; }}else{data.innerhtml + = "success<br/>"} Data.inner Html+=nt},function (context,error) {data.innerhtml + = "{ErrorCode:" +error.code+ ", Message:" +ERROR.M Essage+ "}<br/> ";          Data.innerhtml+=nt;      });  });  }; return dataprovider;}) ();

The rest of the code is all in Websql.rar and can be downloaded directly.

Websql Query Tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.