dblist.js 577 B

12345678910111213141516171819
  1. console.log("Testing Database Listing API");
  2. if (newDBTableIfNotExists("testdb")){
  3. writeDBItem("testdb","One","Hello World")
  4. writeDBItem("testdb","Two","This is a text message")
  5. writeDBItem("testdb","Three","For listing")
  6. writeDBItem("testdb","Four","123456")
  7. writeDBItem("testdb","Five","You can also put JSON string here")
  8. //Try to list db table
  9. var entries = listDBTable("testdb");
  10. sendJSONResp(JSON.stringify(entries));
  11. //Drop the table after testing
  12. dropDBTable("testdb");
  13. console.log("Testdb table dropped");
  14. }else{
  15. sendResp("Failed creating new db");
  16. }