View Full Version : Using code instead of ID for pet management
IntoRain
08-24-2013, 02:41 PM
I noticed there's a code generator already and pets do have codes. I was thinking if it was possible to use the already available codes to manage pets instead of the ID. I'm worried about the function generating repeated codes and issues, so I wanted to ask first if it's safe to use it? I can always compare all used codes in all tables (might be easier to just create a new one with all the used codes), but the thought of comparing a lot of entries each time an egg is created makes me sweat
Hall of Famer
08-24-2013, 09:32 PM
Its not safe to use the code unfortunately. The code is a legacy data column that was unused since the day I was working on this script, weird though. The script checks ID for being numeric, thats why the code should not be used for adoptables identity. The field 'code' will be removed in Mys v1.4.0 btw.
IntoRain
08-24-2013, 10:16 PM
Alright, thank you :) I was planning on removing all those verifications but I see that the ID is used a lot in a lot of different files, it might bring some problems I don't really feel like solving xD I might change to code later on once I finish the important modifications and if I remember some other way to avoid repeated codes
Thank you
Hall of Famer
08-26-2013, 09:55 AM
You are welcome, in fact I do recall a user called SilverDragonTears used to be able to figure out a way to have a long string of characters as ID rather than simple numbers. It may not be easy with the latest script though.
IntoRain
08-26-2013, 01:12 PM
The only way I see is to create a random string and compare it with a list of already used codes (to prevent repeated ones), but depending on the site it can be a large quantity of comparisons. Plus changing/removing the is_numeric verifications sounds a bit boring xD I will get to it later on I think, maybe there's a way to do it in SQL
Hall of Famer
08-26-2013, 03:02 PM
Well you can always use the replace_all functionality from an editor if you wish to get rid of is_numeric() for string comparison instead, not sure how long it will take though.
IntoRain
08-26-2013, 10:24 PM
When I use it I usually end up replacing some function that wasn't supposed to be corrected xD But it is useful for finding them with ease, I completely forgot about that, thank you again! It will take a while but it's better than scrolling down the code xD
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.