(self, node_id, period, count=0)
| 29 | self._conn = sqlite3.connect(self._db_file, detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False) |
| 30 | |
| 31 | def new_historized_node(self, node_id, period, count=0): |
| 32 | with self._lock: |
| 33 | _c_new = self._conn.cursor() |
| 34 | |
| 35 | table = self._get_table_name(node_id) |
| 36 | |
| 37 | self._datachanges_period[node_id] = period, count |
| 38 | |
| 39 | # create a table for the node which will store attributes of the DataValue object |
| 40 | # note: Value/VariantType TEXT is only for human reading, the actual data is stored in VariantBinary column |
| 41 | try: |
| 42 | _c_new.execute('CREATE TABLE "{tn}" (_Id INTEGER PRIMARY KEY NOT NULL,' |
| 43 | ' ServerTimestamp TIMESTAMP,' |
| 44 | ' SourceTimestamp TIMESTAMP,' |
| 45 | ' StatusCode INTEGER,' |
| 46 | ' Value TEXT,' |
| 47 | ' VariantType TEXT,' |
| 48 | ' VariantBinary BLOB)'.format(tn=table)) |
| 49 | |
| 50 | except sqlite3.Error as e: |
| 51 | self.logger.info('Historizing SQL Table Creation Error for %s: %s', node_id, e) |
| 52 | |
| 53 | self._conn.commit() |
| 54 | |
| 55 | def save_node_value(self, node_id, datavalue): |
| 56 | with self._lock: |
nothing calls this directly
no test coverage detected