@@ -67,7 +67,6 @@ def __contains__(self, nodeid):
67
67
def __setitem__ (self , key , value ):
68
68
# TODO the item in the database it is not updated
69
69
super (AddressSpaceSQLite , self ).__setitem__ (key , value )
70
-
71
70
72
71
def keys (self ):
73
72
raise Exception ("dict.keys() is not supported for performance. Use iterator." )
@@ -98,16 +97,17 @@ def dump(self, namespaceidx=AddressSpace.DEFAULT_USER_NAMESPACE_INDEX):
98
97
with self ._lock :
99
98
# 2. Populate.
100
99
for nodeid , ndata in self ._cache .items ():
101
- if nodeid .NamespaceIndex != namespaceidx :
102
- for ref in ndata .references :
103
- if ref .NodeId .NamespaceIndex == namespaceidx :
104
- keyNodeId = AddressSpaceSQLite ._nodeid_to_key (ndata .nodeid )
105
- AddressSpaceSQLite ._insert_reference (self ._conn , keyNodeId , ref )
106
- print ('INTER_NAMESPACE REF {:s}/{:d}->{:d}' .format (str (nodeid .Identifier ), nodeid .NamespaceIndex , ref .NodeId .NamespaceIndex ))
107
- continue
108
100
assert (nodeid == ndata .nodeid )
109
101
assert (isinstance (ndata , NodeData ))
110
- AddressSpaceSQLite ._write_nodedata (self ._conn , ndata )
102
+ if nodeid .NamespaceIndex == namespaceidx :
103
+ AddressSpaceSQLite ._write_nodedata (self ._conn , ndata )
104
+ continue
105
+ # inter-namespace references.
106
+ for ref in ndata .references :
107
+ if ref .NodeId .NamespaceIndex != namespaceidx :
108
+ continue
109
+ keyNodeId = AddressSpaceSQLite ._nodeid_to_key (ndata .nodeid )
110
+ AddressSpaceSQLite ._insert_reference (self ._conn , keyNodeId , ref )
111
111
112
112
# 3. Integrity checks.
113
113
for nodeid , ndata in self ._cache .items ():
@@ -162,11 +162,6 @@ def _read_nodedata(conn, nodeid, nodeData, attrTable=ATTR_TABLE_NAME, refsTable=
162
162
referred_nodeids = [r .NodeId for r in nodeData .references ]
163
163
for row in _c_read .execute (cmd2 ):
164
164
ref = AddressSpaceSQLite ._read_reference_row (row )
165
- #try:
166
- # idx = referred_nodeids.index(ref.NodeId)
167
- # print('DUPLICATE {:s}'.format(str(ref.NodeId)))
168
- # nodeData.references[idx] = ref
169
- #except ValueError:
170
165
nodeData .references .append (ref )
171
166
172
167
# Read and write from attribute table
0 commit comments