Minor updates to MS SQL support

This commit is contained in:
Sam Minnee 2009-03-10 01:19:46 +00:00
parent 41c2cea173
commit b55e15c4e4

View File

@ -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';
} }
/* /*