I'm working on an application that will generate folios for some form filling that the user will make,
internally I will handle a documentId which will be auto incremented, however I have to generate the client's
folio in a diffennt format
Example:
Folio 100613A100
10 - day
06 - month
13 - year
A - if regular
E - if special
100 - AI number
Basically I can the first 7 digits from my PHP code however since I don't know what the AI number will be I can create this value until the insert is done,
My current approach is to do a insert without populating that field and right after the insert use LAST_INSERT_ID()
to generate the Folio and update the table, but this looks kind of an overhead to me so I'm wondering if there any hidden gem
in MySql that would allow to use the AI value on the insert.
Note that I can't use LAST_INSERT_ID()
id before the insert as the app will have concurrent access, my implementation is working just fine and I don't have any issue with it I'm just wondering if is possible for the sake of gaining a little bit of knowldege.