Get attribute name from the new db
(attr)
| 170 | |
| 171 | attrnames = {} |
| 172 | def getattrname(attr): |
| 173 | """Get attribute name from the new db""" |
| 174 | if attr in attrnames: |
| 175 | name = attrnames[attr] |
| 176 | else: |
| 177 | query = 'SELECT attributeName FROM dgmattribs WHERE attributeID = ?' |
| 178 | new_cursor.execute(query, (attr,)) |
| 179 | name = "" |
| 180 | for row in new_cursor: |
| 181 | name = row[0] |
| 182 | if not name: |
| 183 | old_cursor.execute(query, (attr,)) |
| 184 | for row in old_cursor: |
| 185 | name = row[0] |
| 186 | attrnames[attr] = name |
| 187 | return name |
| 188 | |
| 189 | # State table |
| 190 | S = {"unchanged": 0, |