Remove redundant functions IsMSSQL and IsMySQL.

This commit is contained in:
Ansgar Becker
2011-04-19 23:07:52 +00:00
parent 8e253e40fb
commit cb0e54068c
4 changed files with 6 additions and 20 deletions

View File

@ -437,8 +437,6 @@ type
function ConnectionInfo: TStringList;
function GetLastResults: TDBQueryList; virtual; abstract;
function GetCreateCode(Database, Name: String; NodeType: TListNodeType): String; virtual; abstract;
function IsMySQL: Boolean;
function IsMSSQL: Boolean;
procedure ClearDbObjects(db: String);
procedure ClearAllDbObjects;
procedure ParseTableStructure(CreateTable: String; Columns: TTableColumnList; Keys: TTableKeyList; ForeignKeys: TForeignKeyList);
@ -2649,18 +2647,6 @@ begin
end;
function TDBConnection.IsMySQL: Boolean;
begin
Result := Self is TMySQLConnection;
end;
function TDBConnection.IsMSSQL: Boolean;
begin
Result := Self is TAdoDBConnection;
end;
procedure TDBConnection.ParseTableStructure(CreateTable: String; Columns: TTableColumnList; Keys: TTableKeyList; ForeignKeys: TForeignKeyList);
var
ColSpec: String;
@ -3076,10 +3062,10 @@ end;
function TDBConnection.ApplyLimitClause(QueryType, QueryBody: String; Limit, Offset: Cardinal): String;
begin
Result := QueryType + ' ';
if IsMSSQL then
if FParameters.NetTypeGroup = ngMSSQL then
Result := Result + 'TOP('+IntToStr(Limit)+') ';
Result := Result + QueryBody;
if IsMySQL then begin
if FParameters.NetTypeGroup = ngMySQL then begin
Result := Result + ' LIMIT ';
if Offset > 0 then
Result := Result + IntToStr(Offset) + ', ';

View File

@ -2931,7 +2931,7 @@ begin
end else begin
// Concat queries up to a size of max_allowed_packet
if MaxAllowedPacket = 0 then begin
if FConnection.IsMySQL then begin
if FConnection.Parameters.NetTypeGroup = ngMySQL then begin
FConnection.LockedByThread := Self;
MaxAllowedPacket := MakeInt(FConnection.GetVar('SHOW VARIABLES LIKE '+esc('max_allowed_packet'), 1));
FConnection.LockedByThread := nil;

View File

@ -3989,7 +3989,7 @@ begin
Delete(Select, Length(Select)-1, 2);
// Include db name for cases in which dbtree is switching databases and pending updates are in process
Select := Select + ' FROM '+DBObj.Connection.QuoteIdent(ActiveDatabase)+'.';
if DBObj.Connection.IsMSSQL then
if DBObj.Connection.Parameters.NetTypeGroup = ngMSSQL then
Select := Select + DBObj.Connection.QuoteIdent('dbo') + '.';
Select := Select + DBObj.QuotedName;

View File

@ -282,7 +282,7 @@ begin
if DBObject.Name = '' then begin
// Creating new table
editName.Text := '';
if DBObject.Connection.IsMySQL then
if DBObject.Connection.Parameters.NetTypeGroup = ngMySQL then
comboCollation.ItemIndex := comboCollation.Items.IndexOf(MainForm.ActiveConnection.GetVar('SHOW VARIABLES LIKE ''collation_database''', 1));
PageControlMain.ActivePage := tabBasic;
end else begin
@ -964,7 +964,7 @@ begin
// No editor for very first column and checkbox columns
0: Result := False;
3: Result := Col.DataType.HasLength;
4,6: Result := (Col.DataType.Category in [dtcInteger, dtcReal]) and (DBObject.Connection.IsMySQL);
4,6: Result := (Col.DataType.Category in [dtcInteger, dtcReal]) and (DBObject.Connection.Parameters.NetTypeGroup = ngMySQL);
// No editing of collation allowed if "Convert data" was checked
9: Result := not chkCharsetConvert.Checked;
else Result := True;