. , YourModel- > query(). , . CakePHP 2.x, , 1.3.
, . , .
$dataSource = ConnectionManager::getDataSource('your DB');
if(!in_array($tableName, $dataSource->listSources()){
$this->createYourTableFunction();
}
createYourTableFunction MyModel- > query(). SQL. table false, .
$YourModel = new Model(array('table' => false, 'name' => 'YourModel', 'ds' => 'Your DB'));
$YourModel->query('SQL instruction string');