SQLite Forum

Modify rowid via C-API callback
Thank you for all the answers - that helped. We use sqlite as a buffer and interface, relying largely on the preupdate hook, but also authorizer and commit. On these tables we enforce presence of INTEGER PRIMARY KEY.

The problem I am trying to solve is how to create rows that are guaranteed to be unique across different locations that are not in direct communication.

The elegant answer I believe is to create WITHOUT ROWID tables and use an integer column and a location column as index. The location column would be set to the designation of the location. This would require some work, so I was wondering if I could dedicate the upper 32bits of the rowid to a location number, effectively creating subranges specific to each node.

All this is moot since I cannot do this with callbacks. The triggers are an option and I may look into that as a short-term fix. 

Thank you!