See https://github.com/silverstripe/silverstripe-mssql/issues/14 for
more info.
"bigint" doesn't work for PHP 32-bit, as the integer could get too big
for PHP to be able to interpret the value as an integer type. In that
case it would try to approximate it as a float, but that could lead to
a bad assumption for identity columns.
For compatibility, stick with standard "int" type which has a maximum
value of 2147483647.
Note that MySQLAdapter already has this maximum, so changing it to this
keeps this database adapter consistent with MySQL.
In preparation for https://github.com/silverstripe/sapphire/pull/1319
Probably should accept this at the same time.
If someone knows of the relevant ALTER permissions in MSSQL, feel free to implement.
This involves changing a few things around so that it's closer to
how the MySQLDatabase adapter works. indexList() should return an
array in the same format instead of using arbitrary "indexname"
and "spec". indexNames() has also been introduced to MSSQLDatabase
so that we can drop all indexes (except for fulltext and primary key
indexes) on a table when altering the table columns, this helps when
constraints not directly related to a modified column refuse to allow changes.
MSSQL doesn't support putting an alias into the OVER clause,
something which is required when limiting results with an offset.
The workaround is to just put the aggregate inline, taken from
the select list.
Whenever databaseError() is called when a database problem occurred
then the last error is automatically appended to the end of the
general error message.
FIXED: Incorrect implementation of alterIndex
UPDATED: Improved parsing of index specification by including code borrowed from the postgres database connector module. Possibly a candidate for refactor into SS_Database.
Right now the name of a table with a namespace will contain a '\' character. The internal index name generated clashes with this, so we've dealt with it by turning the '\' into a '_'
Fixing the date type to actually be "date", and not "datetime" so
that values are returned as "Y-m-d" for dates, and not "Y-m-d H:i:s".
Additionally, fixing a case where using the mssql functions would
return strange datetime formats. We need the datetime field values
in Y-m-d H:i:s. To get this working, we need to inspect the field type
when retrieving rows from the database and re-format the datetime
value at this point. This is done in MSSQLQuery::nextRecord()