in reply to Re: Getting first unused integer from a sqlite integer column
in thread Getting first unused integer from a sqlite integer column

I agree about the race condition. I like the idea of using an autoincrement for the externalPort. Now I just need to figure out if I can set min and max bounds
min: 1024 max: 65535

Wait a minute... wouldn't redefining the table, making externalPort autoincrement, then creating a dummy record with externalPort = 1023 work? I'll give it a try.