Javascript SQL database

I'm wanting to deliver some data from the server-side to some client-side Javascript which can use said data to construct a database/table, and then query it using some user-input SQL.

Persistence of data isn't what I'm looking for, so HTML5 stuff like localStorage isn't relevant, I'm only wanting to be able to create something like a mini-database in Javascript to query.

Is there any Javascript libraries that have this capability?

Thanks.


看看TrimQuery。


I'd take a look at TaffyDB. It's a database implemented in JavaScript that you can 'query' with objects that resemble where clauses. It's not identical to SQL, but it's close enough that if you're already trusting your users to write queries they should be able to get the hang of it.


You can try Alasql database. It is a JavaScript database with standard 'good old' SQL syntax.

  <script src="alasql.js"></script>  
  <script>
      alasql("CREATE TABLE test (language INT, hello STRING)");
      alasql("INSERT INTO test VALUES (1,'Hello!')");
      alasql("INSERT INTO test VALUES (2,'Aloha!')");
      alasql("INSERT INTO test VALUES (3,'Bonjour!')");
      console.log(alasql("SELECT * FROM test WHERE language > 1"));
  </script>

You can check SQL support with a playground sample in jsFiddle.

链接地址: http://www.djcxy.com/p/2600.html

上一篇: 如何在git中重命名和移动分支(bitucket / sourcetree)

下一篇: Javascript SQL数据库