orange-orm 3.10.3 → 3.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,6 +54,7 @@ function newResolveTransaction(domain, pool) {
54
54
  caller.visitSqlite();
55
55
  };
56
56
  rdb.aggregateCount = 0;
57
+ rdb.cache = {};
57
58
  domain.rdb = rdb;
58
59
  onSuccess();
59
60
  } catch (e) {
@@ -42,6 +42,7 @@ function newResolveTransaction(domain, pool) {
42
42
  caller.visitMySql();
43
43
  };
44
44
  rdb.aggregateCount = 0;
45
+ rdb.cache = {};
45
46
  domain.rdb = rdb;
46
47
  onSuccess();
47
48
  } catch (e) {
@@ -47,6 +47,7 @@ function newResolveTransaction(domain, pool) {
47
47
  caller.visitSqlite();
48
48
  };
49
49
  rdb.aggregateCount = 0;
50
+ rdb.cache = {};
50
51
  domain.rdb = rdb;
51
52
  onSuccess();
52
53
  } catch (e) {
package/src/patchTable.js CHANGED
@@ -3,13 +3,16 @@ let applyPatch = require('./applyPatch');
3
3
  let fromCompareObject = require('./fromCompareObject');
4
4
  let validateDeleteConflict = require('./validateDeleteConflict');
5
5
  let validateDeleteAllowed = require('./validateDeleteAllowed');
6
+ let clearCache = require('./table/clearCache');
6
7
 
7
8
  async function patchTable() {
8
9
  // const dryrun = true;
9
10
  //traverse all rows you want to update before updatinng or inserting anything.
10
11
  //this is to avoid page locks in ms sql
11
12
  // await patchTableCore.apply(null, [...arguments, dryrun]);
12
- return patchTableCore.apply(null, arguments);
13
+ const result = await patchTableCore.apply(null, arguments);
14
+ clearCache();
15
+ return result;
13
16
  }
14
17
 
15
18
  async function patchTableCore(table, patches, { strategy = undefined, deduceStrategy = false, ...options } = {}, dryrun) {
@@ -46,6 +46,7 @@ function newResolveTransaction(domain, pool) {
46
46
  caller.visitPg();
47
47
  };
48
48
  rdb.aggregateCount = 0;
49
+ rdb.cache = {};
49
50
  domain.rdb = rdb;
50
51
  onSuccess();
51
52
  } catch (e) {
@@ -53,6 +53,7 @@ function newResolveTransaction(domain, pool) {
53
53
  caller.visitSap();
54
54
  };
55
55
  rdb.aggregateCount = 0;
56
+ rdb.cache = {};
56
57
  domain.rdb = rdb;
57
58
  onSuccess();
58
59
  } catch (e) {
@@ -42,6 +42,7 @@ function newResolveTransaction(domain, pool) {
42
42
  caller.visitSqlite();
43
43
  };
44
44
  rdb.aggregateCount = 0;
45
+ rdb.cache = {};
45
46
  domain.rdb = rdb;
46
47
  onSuccess();
47
48
  } catch (e) {
@@ -0,0 +1,7 @@
1
+ var setSessionSingleton = require('./setSessionSingleton');
2
+
3
+ function clearCache() {
4
+ setSessionSingleton('cache', {});
5
+ }
6
+
7
+ module.exports = clearCache;
@@ -0,0 +1,8 @@
1
+ var getSessionSingleton = require('./getSessionSingleton');
2
+
3
+ function getSessionCache(id) {
4
+ const cache = getSessionSingleton('cache');
5
+ return cache[id];
6
+ }
7
+
8
+ module.exports = getSessionCache;
@@ -1,6 +1,6 @@
1
1
  let newCache = require('./newCache');
2
- let getSessionSingleton = require('./getSessionSingleton');
3
- let setSessionSingleton = require('./setSessionSingleton');
2
+ let getSessionCache = require('./getSessionCache');
3
+ let setSessionCache = require('./setSessionCache');
4
4
 
5
5
  function newRowCache(table) {
6
6
  let id = Symbol();
@@ -38,11 +38,11 @@ function newRowCache(table) {
38
38
 
39
39
 
40
40
  function getCache(table, id) {
41
- let cache = getSessionSingleton(id);
41
+ let cache = getSessionCache(id);
42
42
  if (cache)
43
43
  return cache;
44
44
  cache = _newRowCache(table);
45
- setSessionSingleton(id, cache);
45
+ setSessionCache(id, cache);
46
46
  return cache;
47
47
  }
48
48
 
@@ -1,3 +1,5 @@
1
+ //todo remove ?
2
+ //unused ?
1
3
  var newRowCache = require('../newRowCache');
2
4
 
3
5
  function newExpanderCache(joinRelation) {
@@ -4,8 +4,8 @@ var synchronizeRemoved = require('./manyCache/synchronizeRemoved');
4
4
  var extractParentKey = require('./manyCache/extractParentKey');
5
5
  var newCacheCore = require('./newManyCacheCore');
6
6
  var newId = require('../../newId');
7
- var getSessionSingleton = require('../getSessionSingleton');
8
- var setSessionSingleton = require('../setSessionSingleton');
7
+ var getSessionCache = require('../getSessionCache');
8
+ var setSessionCache = require('../setSessionCache');
9
9
 
10
10
  function newManyCache(joinRelation) {
11
11
  var c = {};
@@ -25,10 +25,10 @@ function newManyCache(joinRelation) {
25
25
  };
26
26
 
27
27
  c.getInnerCache = function() {
28
- var cache = getSessionSingleton(key);
28
+ var cache = getSessionCache(key);
29
29
  if (!cache) {
30
30
  cache = newCacheCore(joinRelation);
31
- setSessionSingleton(key, cache);
31
+ setSessionCache(key, cache);
32
32
  fillCache();
33
33
  synchronizeAdded(c.tryAdd, joinRelation);
34
34
  synchronizeRemoved(c.tryRemove, joinRelation);
@@ -0,0 +1,8 @@
1
+ var getSessionSingleton = require('./getSessionSingleton');
2
+
3
+ function setSessionCache(id, value) {
4
+ const cache = getSessionSingleton('cache');
5
+ cache[id] = value;
6
+ }
7
+
8
+ module.exports = setSessionCache;
@@ -57,6 +57,7 @@ function newResolveTransaction(domain, pool) {
57
57
  caller.visitSqlite();
58
58
  };
59
59
  rdb.aggregateCount = 0;
60
+ rdb.cache = {};
60
61
  domain.rdb = rdb;
61
62
  onSuccess();
62
63
  } catch (e) {