Friday, December 31, 2010

Re: Urgent Help needed: How to Correct this table so it doesn't have Composite Primary Key?

I think what AD was saying is that the primary purpose of a UUID *when compared with an integer* is that it is globally unique across all servers, not just 'this' server, which of course I forgot to point out in my original reply. This means you have a choice of data type when creating a primary key, both of which have pros/cons. However, it is still a primary key, which has the primary purpose of ensuring data/model integrity.

As far as coding data saves, see http://book.cakephp.org/view/75/Saving-Your-Data for full details.

On 31 Dec 2010, at 17:09, John Maxim wrote:

So normally we don't use char(36) ? and its primary purpose is not for
data /model integrity .. if I hear you right, AD.

Is the Model::save method the way we usually save by calling

function add()
{
}

are there additional steps ?

thanks, best regards.
Maxim


On Dec 29 2010, 7:29 am, AD7six <andydawso...@gmail.com> wrote:
On Dec 28, 3:55 am, John Maxim <goog...@gmail.com> wrote:

Hi Jeremy, Thanks for your link will definitely look into that.

~~Continue my question~~
I was going to ask about using this:http://book.cakephp.org/view/1027/query

There are 2 options if I'm correct based on cookbook 1.3
~~
Rather than using an auto-increment key as the primary key, you may
also use char(36). Cake will then use a unique 36 character uuid
(String::uuid) whenever you save a new record using the Model::save
method.

according to:http://book.cakephp.org/view/903/Model-and-Database-Conventions
~~
What's the advantage of using char(36) ?

A uuid (a 36 char string) is unique - always. It's main purpose is to
be unique, nothing else. Obfuscation is a side effect, not the goal.

They are most relevant with distributed datastores whereby you need to
synchronize data and inserts across multiple servers. An insert on
server A can safely and without concern be replicated to server B
because a row with the same ID cannot exist originating from another
server.

http://en.wikipedia.org/wiki/Universally_unique_identifier

AD

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: