Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define([
- "wilton/DBConnection",
- "wilton/loader",
- "wilton/wiltoncall",
- "wilton/process",
- "wilton/thread",
- "wilton/misc",
- "wilton/CronTask"
- ], function(DBConnection, loader, wiltoncall, process, thread, misc, CronTask) {
- "use strict";
- print("Hello wilton!");
- var config = misc.wiltonConfig();
- var appdir = "";
- if (undefined !== config) {
- appdir = config.applicationDirectory;
- print("appdir: " + appdir);
- } else {
- print("config is undefined");
- }
- var conn = new DBConnection("sqlite://" + appdir + "test.db");
- // var conn = new DBConnection("postgresql://host=127.0.0.1 port=5432 dbname=test user=test password=test");
- conn.execute("drop table if exists t1");
- // // insert
- conn.execute("create table t1 (foo varchar, bar int, bar2 int, bar3 int, bar4 int, bar5 int, bar6 int, bar7 int)");
- conn.execute("insert into t1 values('aaa', 41, 41, 41, 41, 41, 41, 41)");
- conn.execute("insert into t1 values('bbb', 42, 42, 42, 42, 42, 42, 42)");
- conn.execute("insert into t1 values('ccc', 43, 43, 43, 43, 43, 43, 43)");
- var counter = 1;
- var res;
- print("insert ends");
- // for (var i = 0; i < 10; i++) {
- while (1) {
- var res;
- try {
- 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 ", {
- // foo: "ccc",
- bar2: 42,
- bar6: 42
- });
- } catch (e) {
- res = e;
- }
- print("[" + counter + "]: " + JSON.stringify(res));
- ++counter;
- }
- });
Add Comment
Please, Sign In to add comment