2015-01-29, 02:57
I'm not sure what would be the best place to post regarding this issue, so mods, please move this topic or notify me as needed.
I'm using a single MySQL database server to host my Kodi libraries, which are then accessed by several instances of Kodi 14.0.
Lately I have been messing around with interacting with the database directly using Python. This has been a lot of fun, but as I got further into manipulating my databases, one question came up: when adding / removing rows from a table, how does Kodi handle the generation of unique IDs? It looks like most tables have a unique ID value, like the art table has art_id, actors has idActor, etc. For most of the basic stuff, it looks like a new row gets assigned the next unused sequential integer. I'm currently looking at add/removing rows from the art table, but I'm curious how Kodi handles this in the broader context as well.
I'm aware that when attempting to determine what next value is currently unused, I must handle possible concurrence issues.
I'm using a single MySQL database server to host my Kodi libraries, which are then accessed by several instances of Kodi 14.0.
Lately I have been messing around with interacting with the database directly using Python. This has been a lot of fun, but as I got further into manipulating my databases, one question came up: when adding / removing rows from a table, how does Kodi handle the generation of unique IDs? It looks like most tables have a unique ID value, like the art table has art_id, actors has idActor, etc. For most of the basic stuff, it looks like a new row gets assigned the next unused sequential integer. I'm currently looking at add/removing rows from the art table, but I'm curious how Kodi handles this in the broader context as well.
I'm aware that when attempting to determine what next value is currently unused, I must handle possible concurrence issues.