mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
Minor updates to MS SQL support
This commit is contained in:
parent
41c2cea173
commit
b55e15c4e4
@ -129,9 +129,7 @@ class MSSQLDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getGeneratedID($table) {
|
public function getGeneratedID($table) {
|
||||||
$result=DB::query("SELECT last_value FROM \"{$table}_ID_seq\";");
|
return $this->query("SELECT @@IDENTITY FROM \"$table\"")->value();
|
||||||
$row=$result->first();
|
|
||||||
return $row['last_value'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,6 +213,7 @@ class MSSQLDatabase extends Database {
|
|||||||
$fulltexts
|
$fulltexts
|
||||||
primary key (\"ID\")
|
primary key (\"ID\")
|
||||||
); $indexSchemas");
|
); $indexSchemas");
|
||||||
|
$this->query("SET IDENTITY_INSERT \"$tableName\" ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -654,7 +653,7 @@ class MSSQLDatabase extends Database {
|
|||||||
if($asDbValue)
|
if($asDbValue)
|
||||||
return Array('data_type'=>'text');
|
return Array('data_type'=>'text');
|
||||||
else
|
else
|
||||||
return 'text';
|
return 'text null';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -685,7 +684,7 @@ class MSSQLDatabase extends Database {
|
|||||||
if($asDbValue)
|
if($asDbValue)
|
||||||
return Array('data_type'=>'character varying', 'character_maximum_length'=>'255');
|
return Array('data_type'=>'character varying', 'character_maximum_length'=>'255');
|
||||||
else
|
else
|
||||||
return 'varchar(' . $values['precision'] . ')';
|
return 'varchar(' . $values['precision'] . ') null';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user