mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
API CHANGE: dates default to null
This commit is contained in:
parent
2666d961db
commit
c80d8faf92
@ -40,6 +40,8 @@ class MSSQLDatabase extends Database {
|
|||||||
public function __construct($parameters) {
|
public function __construct($parameters) {
|
||||||
//assumes that the server and dbname will always be provided:
|
//assumes that the server and dbname will always be provided:
|
||||||
$this->dbConn = mssql_connect($parameters['server'], $parameters['username'], $parameters['password']);
|
$this->dbConn = mssql_connect($parameters['server'], $parameters['username'], $parameters['password']);
|
||||||
|
$this->active = mssql_select_db($parameters['database'], $this->dbConn);
|
||||||
|
$this->database = $parameters['database'];
|
||||||
|
|
||||||
if(!$this->dbConn) {
|
if(!$this->dbConn) {
|
||||||
$this->databaseError("Couldn't connect to MS SQL database");
|
$this->databaseError("Couldn't connect to MS SQL database");
|
||||||
@ -544,7 +546,7 @@ class MSSQLDatabase extends Database {
|
|||||||
//$parts=Array('datatype'=>'date');
|
//$parts=Array('datatype'=>'date');
|
||||||
//DB::requireField($this->tableName, $this->name, "date");
|
//DB::requireField($this->tableName, $this->name, "date");
|
||||||
|
|
||||||
return 'date';
|
return 'date null';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -631,7 +633,7 @@ class MSSQLDatabase extends Database {
|
|||||||
if($asDbValue)
|
if($asDbValue)
|
||||||
return Array('data_type'=>'datetime without time zone');
|
return Array('data_type'=>'datetime without time zone');
|
||||||
else
|
else
|
||||||
return 'datetime default CURRENT_TIMESTAMP';
|
return 'datetime null';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -724,6 +726,13 @@ class MSSQLDatabase extends Database {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SQL command to get all the tables in this database
|
||||||
|
*/
|
||||||
|
function allTablesSQL(){
|
||||||
|
return "SELECT name FROM {$GLOBALS['database']}..sysobjects WHERE xtype = 'U';";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this table exists
|
* Returns true if this table exists
|
||||||
* @todo Make a proper implementation
|
* @todo Make a proper implementation
|
||||||
|
Loading…
Reference in New Issue
Block a user