Guest User

Untitled

a guest
Sep 5th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. define([
  2. "wilton/DBConnection",
  3. "wilton/loader",
  4. "wilton/wiltoncall",
  5. "wilton/process",
  6. "wilton/thread",
  7. "wilton/misc",
  8. "wilton/CronTask"
  9. ], function(DBConnection, loader, wiltoncall, process, thread, misc, CronTask) {
  10. "use strict";
  11. print("Hello wilton!");
  12.  
  13. var config = misc.wiltonConfig();
  14. var appdir = "";
  15. if (undefined !== config) {
  16. appdir = config.applicationDirectory;
  17. print("appdir: " + appdir);
  18. } else {
  19. print("config is undefined");
  20. }
  21.  
  22.  
  23. var conn = new DBConnection("sqlite://" + appdir + "test.db");
  24. // var conn = new DBConnection("postgresql://host=127.0.0.1 port=5432 dbname=test user=test password=test");
  25.  
  26. conn.execute("drop table if exists t1");
  27. // // insert
  28. conn.execute("create table t1 (foo varchar, bar int, bar2 int, bar3 int, bar4 int, bar5 int, bar6 int, bar7 int)");
  29. conn.execute("insert into t1 values('aaa', 41, 41, 41, 41, 41, 41, 41)");
  30. conn.execute("insert into t1 values('bbb', 42, 42, 42, 42, 42, 42, 42)");
  31. conn.execute("insert into t1 values('ccc', 43, 43, 43, 43, 43, 43, 43)");
  32. var counter = 1;
  33. var res;
  34.  
  35. print("insert ends");
  36. // for (var i = 0; i < 10; i++) {
  37. while (1) {
  38. var res;
  39. try {
  40. res = conn.queryList("select * from t1 where foo = :foo or bar = :bar or bar2 = :bar2 or bar3 = :bar3 or bar4 = :bar4 or bar5 = :bar5 or bar6 = :bar6 or bar7 = :bar7 ", {
  41. // foo: "ccc",
  42. bar2: 42,
  43. bar6: 42
  44. });
  45. } catch (e) {
  46. res = e;
  47. }
  48.  
  49. print("[" + counter + "]: " + JSON.stringify(res));
  50. ++counter;
  51. }
  52.  
  53. });
Add Comment
Please, Sign In to add comment