ZF-7759: Some Mssql Number types fail to insert due to quotes


Mssql 2008 fails to insert using the insert method due to quotes. Mssql can convert Double and Int but throws an error for money and small money types.



CREATE TABLE dbo.testMoney
    id int NOT NULL IDENTITY (1, 1),
    paid money NOT NULL
    )  ON [PRIMARY]


class MoneyTable extends Zend_Db_Table_Abstract
 protected $_name = "testMoney";

$db = new MoneyTable;

$data = array('paid' => 5.25);

Query Created (taken from sql profiler)

INSERT INTO "testMoney" ("paid") VALUES ('5.25')

This causes Sql Server to fail since the 5.25 is in quotes. The query should be:

INSERT INTO "testMoney" ("paid") VALUES (5.25)


What adapter & driver are you using?

freedts on ubuntu. I adjusted the Zend_Db_Adapter_Pdo_Mssql and changed the _pdotype to be dblib.

This appears to be an issue inside of MSSQL. I am still looking into what the issue with MSSQL to find out why this is failing. I actually found that on a table of mine with 4 money fields, it wanted me to CAST for only 1 out of those 4 fields.

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.