Re: Model Save bug? (CakePHP 1.2 & MySQL)

2007-09-04 Thread [EMAIL PROTECTED]



On Sep 4, 5:16 pm, MrTufty <[EMAIL PROTECTED]> wrote:
> I doubt it's a bug with Cake... if you have fields specifically set to
> be unique in the database, then nothing Cake can do should allow NON-
> unique fields. Seems very strange. I would imagine that the records
> that appear to be non-unique actually are unique, but probably with
> hidden characters or something of that sort.
>
> Do you have any more details?

Hm. What's more?

When debug set in 1.

I see MySQL warning about key

Warning (512): SQL Error: 1062: Duplicate entry 'test' for key 2 [CORE
\cake\libs\model\datasources\dbo_source.php, line 463

And in my controller action add in

if($this->User->save($this->data)) {
$this->flash('All good','/login');
$this->redirect(array('action'=>'index'), null, 
true);
} else {
$this->data['User']['password'] = null;
$this->Session->setFlash('All bad');
}
I get "All bad";

When I (don't change code) change debug to 0

I don't see (of couse) SQL Error
And (!) don't see "error" - I see "All good". And finaly I have two
records in table with equal fields, who must be unique.

Where is my error? In case it's don't Cake error?


>
> On Sep 4, 1:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > In table I have two fields UNIQUE.
>
> > When I set debug level = 1, after Model->save, I can see: "MySQL
> > warning" & I get my own warning, which show, when Model->save fail.
>
> > But, when I switch into debug level = 0 . I don't see any warning and
> > get records in my table with non unique fields!
>
> > It's bug?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Model Save bug? (CakePHP 1.2 & MySQL)

2007-09-04 Thread MrTufty

I doubt it's a bug with Cake... if you have fields specifically set to
be unique in the database, then nothing Cake can do should allow NON-
unique fields. Seems very strange. I would imagine that the records
that appear to be non-unique actually are unique, but probably with
hidden characters or something of that sort.

Do you have any more details?

On Sep 4, 1:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> In table I have two fields UNIQUE.
>
> When I set debug level = 1, after Model->save, I can see: "MySQL
> warning" & I get my own warning, which show, when Model->save fail.
>
> But, when I switch into debug level = 0 . I don't see any warning and
> get records in my table with non unique fields!
>
> It's bug?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Model Save bug? (CakePHP 1.2 & MySQL)

2007-09-04 Thread [EMAIL PROTECTED]

In table I have two fields UNIQUE.

When I set debug level = 1, after Model->save, I can see: "MySQL
warning" & I get my own warning, which show, when Model->save fail.

But, when I switch into debug level = 0 . I don't see any warning and
get records in my table with non unique fields!

It's bug?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---