Yii Framework Forum: Cdbcommand binding array for SQL IN clause - Yii Framework Forum

Jump to content

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

Cdbcommand binding array for SQL IN clause Rate Topic: -----

#1 User is offline   vitman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 09-April 12

Posted 01 June 2012 - 05:52 AM

I want to have something like
$some_values = array(1,2,3,4,5);
Yii::app()->getDb()->createCommand('SELECT x FROM y WHERE z in (:p1)')->bindValuesForInClause(':p1'=>$some_values)->queryAll();

0

#2 User is offline   Rajith R 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 598
  • Joined: 20-April 11
  • Location:Kochi , Kerala, India

Posted 01 June 2012 - 06:26 AM

use findAll()
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#3 User is offline   vitman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 09-April 12

Posted 01 June 2012 - 06:45 AM

View PostRajith R, on 01 June 2012 - 06:26 AM, said:

use findAll()

Not an answer.

I have some really huge queries with some IN clauses written on pure pl/sql.AR not a solution here.
0

#4 User is offline   alex-w 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 180
  • Joined: 25-November 10

Posted 01 June 2012 - 09:31 AM

If you can use the query builder, http://www.yiiframew...bCommand#where()-detail
0

#5 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 413
  • Joined: 08-August 09
  • Location:Ukraine

Posted 02 June 2012 - 12:38 AM

View Postvitman, on 01 June 2012 - 05:52 AM, said:

I want to have something like
$some_values = array(1,2,3,4,5);
Yii::app()->getDb()->createCommand('SELECT x FROM y WHERE z in (:p1)')->bindValuesForInClause(':p1'=>$some_values)->queryAll();



Maybe idea from Stackoverflow will be helpful.
0

#6 User is offline   vitman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 09-April 12

Posted 04 June 2012 - 10:03 AM

Thanks for replies.

BUT is this will not be useful if yii will do it automatically?
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