mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Get away from using "2008", "2000" version numbers for MSSQL, to add compatibility to old MS SQL servers, e.g. 7.0 had no year-styled version. Instead, use 700 for 7.0, 800 for 2000, and so on. Use these more exact version numbers to fix a 7.0 issue in TAdoDBConnection.GetAllDatabases. See http://www.heidisql.com/forum.php?t=11230.
This commit is contained in:
@@ -1406,7 +1406,7 @@ begin
|
||||
FSQLSpecifities[spAddColumn] := 'ADD %s';
|
||||
FSQLSpecifities[spChangeColumn] := 'ALTER COLUMN %s %s';
|
||||
case ServerVersionInt of
|
||||
2000: begin
|
||||
0..899: begin
|
||||
FSQLSpecifities[spDatabaseTable] := QuoteIdent('master')+'..'+QuoteIdent('sysdatabases');
|
||||
FSQLSpecifities[spDatabaseTableId] := QuoteIdent('dbid');
|
||||
FSQLSpecifities[spDbObjectsTable] := '..'+QuoteIdent('sysobjects');
|
||||
@@ -1945,13 +1945,21 @@ end;
|
||||
function TAdoDBConnection.GetServerVersionInt: Integer;
|
||||
var
|
||||
rx: TRegExpr;
|
||||
v1, v2: String;
|
||||
begin
|
||||
rx := TRegExpr.Create;
|
||||
// See http://support.microsoft.com/kb/321185
|
||||
// "Microsoft SQL Server 7.00 - 7.00.1094 (Intel X86)" ==> 700
|
||||
// "Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)" ==> 1000
|
||||
// "Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86)" ==> 1050
|
||||
rx := TRegExpr.Create;
|
||||
rx.ModifierG := False;
|
||||
rx.Expression := '(\d{4})\D';
|
||||
if rx.Exec(FServerVersionUntouched) then
|
||||
Result := MakeInt(rx.Match[1])
|
||||
else
|
||||
rx.Expression := '\s(\d+)\.(\d+)\D';
|
||||
if rx.Exec(FServerVersionUntouched) then begin
|
||||
v1 := rx.Match[1];
|
||||
v2 := rx.Match[2];
|
||||
Result := StrToIntDef(v1, 0) *100 +
|
||||
StrToIntDef(v2, 0);
|
||||
end else
|
||||
Result := 0;
|
||||
rx.Free;
|
||||
end;
|
||||
@@ -2046,8 +2054,12 @@ end;
|
||||
|
||||
|
||||
function TAdoDBConnection.ConvertServerVersion(Version: Integer): String;
|
||||
var
|
||||
v1, v2: Integer;
|
||||
begin
|
||||
Result := IntToStr(Version);
|
||||
v1 := Version div 100;
|
||||
v2 := Version mod (Version div 100);
|
||||
Result := IntToStr(v1) + '.' + IntToStr(v2);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user