View Single Post
Old June 26th, 2017, 03:46 PM   #15
retroanalyst
in memoriam Max
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 3,586
Thanks: 121,998
Thanked 47,466 Times in 3,337 Posts
retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+
Default

Quote:
Originally Posted by herkalurk View Post
When you create a standard sql type database (mysql,mssql,oracle), you set structure around your data. So in the field for the gallery hash, I say that this field should be 5 characters long and a type of standard characters (letters numbers, etc). I did the same thing for my imagebam database. Since their gallery hash is 32 characters long that is the length allowed in that field in the database I made for that upload tool.

This gets into protecting your inputs, and data validation. If you were to have a field of only numbers you would limit it to only integer inputs so no one could accidentally put letters there.
That's all nice, but the Pixhost API guarantees only that the gallery hash is a string, not what length it has. Thus, storing it in a fixed-length datatype record is asking for trouble.

While I was looking closer at the API, I wondered why there are two different hashes in the first place and why they don't use a single long hash. Must be because they want to allow sharing galleries via Twitter, so the URL had better be short.
__________________
Genius may have its limitations, but stupidity is not thus handicapped.
retroanalyst is offline   Reply With Quote
The Following 2 Users Say Thank You to retroanalyst For This Useful Post: