Hi, I would also like to use microsoft sql (MSSQL). Can anyone help us or give us hint how to edit adapter file to get it work with MSSQL?
Thank you very much!
Hi Francesco and anyone else,
I talked to funkjedi (former author of sql adapter) and he put his code back to GitHub and there's open pull request (https://github.com/jpfuentes2/php-activerecord/pull/409)
Here is the code:
https://github.com/funkjedi/php-activerecord/tree/feature-sqlsrv
Enjoy!
thanks
I am going to test this with my SQL
I will post any news from me in a few hours
I had some problems with it, but I fixed it. I am using SQL 2014 Server. In SqlsrvAdapter.php:
Add
static $datetime_format = 'Y-m-d H:i:s';
This overrides default datetime_format in Model. There is T (Timezone abbreviation) but SQL don't accept it.
In method query_column_info
I changed following:
$sql = "SELECT c.COLUMN_NAME as field, c.DATA_TYPE as data_type, c.CHARACTER_MAXIMUM_LENGTH AS length, c.NUMERIC_PRECISION_RADIX AS radix, c.COLUMN_DEFAULT AS data_default, c.IS_NULLABLE AS nullable, " . "COLUMNPROPERTY(OBJECT_ID(TABLE_NAME), c.COLUMN_NAME, 'IsIdentity') AS extra, " . "(SELECT TOP 1 a.CONSTRAINT_TYPE " . "FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS a, INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE b " . "WHERE a.CONSTRAINT_TYPE='PRIMARY KEY' " . "AND a.CONSTRAINT_NAME = b.CONSTRAINT_NAME " . "AND a.TABLE_NAME = b.TABLE_NAME AND b.COLUMN_NAME = c.COLUMN_NAME) AS PK " . "FROM INFORMATION_SCHEMA.COLUMNS c " . "WHERE c.TABLE_NAME=?";
I added SELECT TOP 1 because it was returning multiple lines and throws SQL error.
It should works now.
(1-4/4)
Subject: so no microsoft sqlsrv
Finally, there is no way to use microsoft sql server ?