Yii Framework Forum: Upgrading breaks query - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Upgrading breaks query Rate Topic: -----

#1 User is offline   tixrus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 21-August 09

Posted 25 October 2009 - 07:06 PM

Just upgraded to 1.1
I got rid of the safe attributes as required, but otherwise made no other changes in my source. I thought safe attributes was pretty strange anyway and could be out of phase with
other things you specify.


Now I get this:

Error in querying SQL: SELECT comments.`id` AS `t1_c0`, comments.`userId`
AS `t1_c1`, comments.`jokeId` AS `t1_c2`, comments.`comment` AS `t1_c3`,
comments.`dateCreated` AS `t1_c4`, comments.`dateUpdated` AS `t1_c5`,
comments.`status` AS `t1_c6` FROM `Comment` comments WHERE
(comments.`jokeId`=:ypl0) ORDER BY ??.dateCreated. Bind with parameter
:ypl0='1'

It didn't do this before. What other information will I need to provide or adjustments to make to be able to fix this?
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,906
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 October 2009 - 07:11 PM

In 1.1, you no longer use ?? as table prefix. If you perform relational query, use the relation name as the prefix by default.
0

#3 User is offline   tixrus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 21-August 09

Posted 25 October 2009 - 07:23 PM

I don't understand what you mean "use the relation name as the prefix by default." What is the relation name?

I think this is the rule causing problem

'comments' => array(self::HAS_MANY, 'Comment', 'jokeId',
'order'=>'??.dateCreated',
),

What *exactly* do I do to it to fix it?
0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,906
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 October 2009 - 07:26 PM

What I mean is removing ??. prefix in your 'order' option.
0

#5 User is offline   tixrus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 21-August 09

Posted 25 October 2009 - 07:30 PM

Whoo hoo I stopped it borking. I changed everywhere '??.whatever' to 'whatever'
that was just a guess. You talk at way too high level for me!



View Posttixrus, on 25 October 2009 - 07:23 PM, said:

I don't understand what you mean "use the relation name as the prefix by default." What is the relation name?

I think this is the rule causing problem

'comments' => array(self::HAS_MANY, 'Comment', 'jokeId',
'order'=>'??.dateCreated',
),

What *exactly* do I do to it to fix it?

0

#6 User is offline   tixrus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 21-August 09

Posted 25 October 2009 - 07:32 PM

Real time forum posting anyway thanks. Works now, now I can go back to the other problem I posted today in the 1.0.? list. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users