| 95 | return affGridIDs |
| 96 | |
| 97 | def insertCommit(self): |
| 98 | conn = sqlite3.connect(self.dataBase, check_same_thread=False) |
| 99 | cur = conn.cursor() |
| 100 | commitCnt = 0 |
| 101 | while not self.dataQue.empty(): |
| 102 | tableName, data, process = self.dataQue.get() |
| 103 | sql = '{} INTO {} VALUES '.format(process, tableName) + \ |
| 104 | '(' + '?,'*(len(data)-1) + '?' + ')' |
| 105 | try: |
| 106 | cur.execute(sql, data) |
| 107 | except sqlite3.OperationalError as e: |
| 108 | print(sql, data) |
| 109 | commitCnt += 1 |
| 110 | if commitCnt == 10000: |
| 111 | conn.commit() |
| 112 | commitCnt = 0 |
| 113 | conn.commit() |
| 114 | cur.close() |
| 115 | conn.close() |
| 116 | |
| 117 | print('[green bold]Network information commited at {}.[/green bold]'.format( |
| 118 | datetime.now().strftime('%H:%M:%S.%f')[:-3])) |
| 119 | |
| 120 | def processRawShape(self, rawShape: str) -> list: |
| 121 | rawList = rawShape.split(' ') |