We have developed our app in CakePHP running with MYSQL and this is working fine. PHP version is 5.4.16, Apache 2.4.4, latest XAMP. CakePHP version: 2.3.0
We already have similar Database in MSSQL also. Now we want to run our app with this MSSQL also.
We are using php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll for MSSQL driver for this. Its sql server 2005.
Whenever we are updating values in tables, we are using UpdateAll() of Model.Php which further calls update() of the corresponding datasource. Our code is like this.
if ($this->Configurationtable->updateAll(array('Configurationtable.configuration_optionsetting' => $limit ),
array('Configurationtable.configuration_optionname =' => $optionName))) {
$this->Session->setFlash('The Result Limit has been updated');
$this->redirect(array('action' => 'edit'));
} else
{
$this->Session->setFlash('The configuration could not be saved. Please, try again.');
}
Now this works fine in MySql and generated the following Update query
UPDATE ipa.configurationtable AS Configurationtable SET Configurationtable.configuration_optionsetting = 12 WHERE Configurationtable.configuration_optionname = 'searchPaginationLimit'
But in MS Sql Server, it fails and generates completely wrong query which is
SELECT [Configurationtable].[id] AS [Configurationtable__id] FROM [configurationtable] AS [Configurationtable] WHERE [Configurationtable].[configuration_optionname] = N'searchPaginationLimit'
Now, If I make Update() function in \lib\Cake\Model\Datasource\Database\Sqlserver.php similar to Update() in \lib\Cake\Model\Datasource\Database\Mysql.php then it works fine. It generates proper correct "Update" query
I could not figure out why is it going so? Is it something I am going wrong OR there is bug in cake?
Any would be of great help.