Re: MySQL Duplicate entry on Create Error

2009-11-25 Thread jburns
Never say never. There may well be cases where a tinyint is
sufficient. I agree that it is bad bad bad if you are going to let the
user add/delete rows willy nilly (in which case you can hit the
ceiling as TimG did), but I have often used an autoincrementing
tinyint in cases where I know there will be a defined and finite list
of entries. Keeping it to tinyint keeps the database footprint small.
Its horses for courses, I guess.

On Nov 25, 11:06 am, euromark  wrote:
> autoincrement keys should ALWAYS int(>10) etc, never ever tinyint!
>
> On 25 Nov., 07:07, TimG  wrote:
>
>
>
> > Thank you sir you are a miracle worker!!!

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: MySQL Duplicate entry on Create Error

2009-11-25 Thread euromark
autoincrement keys should ALWAYS int(>10) etc, never ever tinyint!

On 25 Nov., 07:07, TimG  wrote:
> Thank you sir you are a miracle worker!!!

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: MySQL Duplicate entry on Create Error

2009-11-24 Thread TimG
Thank you sir you are a miracle worker!!!

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: MySQL Duplicate entry on Create Error

2009-11-24 Thread jburns
It sounds like the data type of your id field is a signed tinyint,
which has a maximum value of 127. The range is -127 to 127 (or
something close to that). You need to change the data type. If you
make it unsigned it has a range of 0 to 255. If that isn't enough
you'll have to increase it to smallint.

I generally use unsigned integers as I rarely need to store minus
values (especially if they auto increment) and they take up less
database space. When you make the change from signed to unsigned in
your database clear down the size field as you do it. Depending upon
the tool you are using to manage your database (I use the excellent
Sequel Pro) it will default it to the smallest acceptable value.

On Nov 25, 5:51 am, TimG  wrote:
> I was inserting new rows through my application and then suddenly I
> started receiving this error:
>
> Warning (512): SQL Error: 1062: Duplicate entry '127' for key 1
> [CORE/cake/libs/model/datasources/dbo_source.php, line 525]
>
> The AUTO_INCRIMENT is set to 128 on the 'id' field and it was working
> perfectly until now. It seems stuck on trying to create id '127'. Any
> ideas?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


MySQL Duplicate entry on Create Error

2009-11-24 Thread TimG
I was inserting new rows through my application and then suddenly I
started receiving this error:

Warning (512): SQL Error: 1062: Duplicate entry '127' for key 1
[CORE/cake/libs/model/datasources/dbo_source.php, line 525]

The AUTO_INCRIMENT is set to 128 on the 'id' field and it was working
perfectly until now. It seems stuck on trying to create id '127'. Any
ideas?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en