[Solved] Problem with select

I have one problem with the creation of a Select Condition or CDbCriteria object via usage of the Yii functions.

My problem is I have several Search Condition (which aren't static)

e.g.

I have easy Selects like this:



SELECT ID, Company, Address1, Address2, Address3, City, Country 


FROM `tbcompany` 


WHERE 


(`tbcompany`.`Address1` LIKE '%searchstreet%' OR 


`tbcompany`.`Address2` LIKE '%searchstreet%' OR 


`tbcompany`.`Address3` LIKE '%searchstreet%')


 AND (`tbcompany`.`City` LIKE '%heidelberg%')


The seperated Condition for each Searchpattern Part are created with usage of the createSearchCondition Funktion:



$condition=$builder->createSearchCondition($schema,$columns,$keywords,$prefix=null);


Where $columns and $keywords for each part would look like this:



$columns: array('0'=>'Address1', '1'=>'Address2', '2'=> 'Address3');


$keywords=array('0'=>'searchstreet')





$columns: array('0'=>'City')


$keywords: array('0'=>'heidelberg')


But how can I create a search Condition for an Column of Type integer

like



`tbcompany`.`ID` IN (28, 29, 30)


I knew that I can create this condition with



$condition=$builder->createPkCondition($schema,array(28,29,30),$prefix);


If the column of interest is the Primary Key but what if its a normal integer colum ?

Am I only blind to see the function?

Please helpĀ  ???

Btw I collect all my conditions in an array "$condition_array" and combine them via the code below and create the full sql string or using the findAll method.



$criteria=new CDbCriteria;


$criteria->condition=implode(' AND ',$condition_array);


$criteria->select=$selected_columns_array;


$firephp->log($criteria, '$criteria');


$command=$builder->createFindCommand($schema,$criteria);


$sql=$command->getText();





$firephp->log($sql, '$sql');


$ResultList=$this->model->findAllBySql($sql,$params);


//or


$ResultList=$this->model->findAll($criteria,$params);





In the upcoming 1.0.4, there's a createInCondition() that you can use.

thats what I wanted to hear ;) I really wondered if I am only blind or stupid.

Is it available in the current svn version?

Thanks I have itĀ  ;D

Tested it and it works perfectly as expected