Friday, November 5, 2010

Re: Ensuring uniqueness on application level

Good points about hosting. Whatever you do at the front end you are more than a bit hampered if you can't rely on talking to the database.

I'd say you shouldn't find a workaround for something so important. Even if you are using soft delete you still don't want the same [unique] key floating around twice - that is a nightmare waiting to happen. If you are using soft delete is suggests that someone can soft undelete - what happens if that produces a clash with another undeleted id?

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 5 Nov 2010, at 06:39, MissYeh wrote:

> First off.. if the DB connection sometimes (aka too often) breaks,
> then find a better host else it will give you lots more headache in
> the future. It is crucial to have the best server environment you can
> possibly get. I don't think isUnique will be of any use when your DB
> connection breaks.
>
> An other option is to add another database. If one isn't reachable,
> then the other takes over. A failover database.
>
> An other option is to cache all the unique values eg every time it
> gets updated. If there is no DB connection, then check the cached file
> to see if the name in it exists. If it doesn't, then let the user
> choose the name and continue register.
>
>
>
> On Nov 5, 9:23 am, Éber <eber.frei...@gmail.com> wrote:
>> Hey guys!
>>
>> I'm having a little bit of trouble with validation on my models. That
>> is because I'm using isUnique on some fields, but I didn't defined the
>> fields as unique keys on the DB (I'm using MySQL). I can't make them
>> unique keys right now because I'm using soft deletion on these models.
>>
>> The thing is that, sometimes the DB connection will break, and
>> isUnique won't return a valid value, making it possible for my users
>> to register things with the same name, which is causing a lot of
>> trouble for me. I was trying to think in a way to ensure that, even
>> when the DB fails, I get some sort of good value from isUnique, so the
>> user won't be able to register with a duplicated name...
>>
>> Does anyone have any hints on how can I do this the best way possible?
>>
>> Thanks!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: