Hello Hannibal, I actually want to store some meaningful text as UUID so that it is search engine optimized. I am taking file names as UUID but then same users can upload files having same name, due to this problem i am finding the UUID in the database to generate a unique filename.. i hope i were clear.
thanks. On Thu, Jun 19, 2008 at 4:12 PM, dr. Hannibal Lecter <[EMAIL PROTECTED]> wrote: > > Does this help in any way: > > http://manual.cakephp.org/view/70/primary-keys-used-as-uuids > > ? > > On Jun 18, 7:24 pm, "Novice Programmer" <[EMAIL PROTECTED]> > wrote: > > Hello all, > > > > This is more of a database question but since this group contains a lot > of > > db experts as well, I am throwing it here as well.. I am having a table > > which represents entities... User can upload entities(pics, videos etc).. > i > > want that no entity overwrite the other, but my entities can be on > multiple > > servers.. so i can't check the file system for the save name of the > entity. > > I need to refer to the table to see the entity_name... later on i use the > > name as unique id.. here is the code that does the trick.. > > > > $result = $this->Entity->findByEntityUid($newfile); > > > > if (isset($result)) { > > $filenumber = 0; > > $filesuffix = ''; > > $fileparts = explode('.', $newfile); > > $fileext = '.' . array_pop($fileparts); > > $filebase = implode('.', $fileparts); > > > > do { > > $filenumber++; > > $filesuffix = '-' . $filenumber; > > $entity_uid = $filebase . $filesuffix; > > $newfile = $entity_uid . $fileext; > > } while ($this->Entity->findByEntityUid($entity_uid)); > > > > But i am worried that this code is not thread safe... Can some one > suggest > > me that how to go about this problem? More over i want to use the same > > entity uid as a primary key to the table so more worries come in when i > > think that duplicate enteries can come in because of the code that is not > > thread safe.. Please help.. > > > > -- > > Thanks & Regards, > > Novice. > > > -- Thanks & Regards, Novice. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
