Skip to content
Permalink
Browse files

Trim SSH host name, and revert some recently accidentally committed d…

…ebug lines
  • Loading branch information...
ansgarbecker committed Jul 28, 2019
1 parent 74961f4 commit 82241e7a6ff9cc31ca6bd8c917eb4ad71bf2bb02
Showing with 6 additions and 28 deletions.
  1. +6 −28 source/dbconnection.pas
@@ -821,10 +821,10 @@ procedure TPlink.Connect;
// Build plink.exe command line
// plink bob@domain.com -pw myPassw0rd1 -P 22 -i "keyfile.pem" -L 55555:localhost:3306
PlinkCmd := FConnection.Parameters.SSHPlinkExe + ' -ssh ';
if FConnection.Parameters.SSHUser <> '' then
PlinkCmd := PlinkCmd + FConnection.Parameters.SSHUser + '@';
if FConnection.Parameters.SSHHost <> '' then
PlinkCmd := PlinkCmd + FConnection.Parameters.SSHHost
if FConnection.Parameters.SSHUser.Trim <> '' then
PlinkCmd := PlinkCmd + FConnection.Parameters.SSHUser.Trim + '@';
if FConnection.Parameters.SSHHost.Trim <> '' then
PlinkCmd := PlinkCmd + FConnection.Parameters.SSHHost.Trim
else
PlinkCmd := PlinkCmd + FConnection.Parameters.Hostname;
if FConnection.Parameters.SSHPassword <> '' then begin
@@ -1922,7 +1922,6 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
ntMSSQL_VINES: NetLib := 'DBMSVINN';
ntMSSQL_RPC: NetLib := 'DBMSRPCN';
end;
//fadohandle.Properties.Item['Initial Catalog'] := '';

DataSource := Parameters.Hostname;
if (Parameters.NetType = ntMSSQL_TCPIP) and (Parameters.Port <> 0) then
@@ -2730,10 +2729,6 @@ function TMySQLConnection.GetCreateCode(Obj: TDBObject): String;
Result := GetCreateViewCode(Obj.Database, Obj.Name)
else
Result := GetVar('SHOW CREATE '+UpperCase(Obj.ObjType)+' '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name), Column);
//if UpperCase(Obj.ObjType)='TABLE' then begin
// Result := Result + ' `compression`=''tokudb_zlib''';
//Log(lcinfo, Result);
//end;
TmpObj.Free;
end;

@@ -3170,7 +3165,6 @@ procedure TDBConnection.SetDatabase(Value: String);
end else
s := QuoteIdent(Value);
Query(Format(GetSQLSpecifity(spUSEQuery), [s]), False);
//TAdoDBConnection(self).fadohandle.ConnectionObject.Properties.Item['Initial Catalog'] := Value;
end;
if Assigned(FOnObjectnamesChanged) then
FOnObjectnamesChanged(Self, FDatabase);
@@ -3371,7 +3365,6 @@ function TAdoDBConnection.GetLastErrorMsg: String;

function TPgConnection.GetLastErrorMsg: String;
begin
// https://support.microsoft.com/en-us/help/3179560/update-for-visual-c-2013-and-visual-c-redistributable-package
Result := DecodeAPIString(FLib.PQerrorMessage(FHandle));
Result := Trim(Result);
end;
@@ -4391,14 +4384,6 @@ function TMySQLConnection.ExplainAnalyzer(SQL, DatabaseName: String): Boolean;
i: Integer;
begin
// Send EXPLAIN output to MariaDB.org

// Mimimum structure of what seems compatible:
//+
//|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|
//+
//|1|SIMPLE|t1|ALL|NULL|NULL|NULL|NULL|3||
//|1|SIMPLE|t1|ALL|NULL|NULL|NULL|NULL|3||

Result := True;
Database := DatabaseName;
Results := GetResults('EXPLAIN '+SQL);
@@ -5114,7 +5099,6 @@ procedure TDBConnection.ParseTableStructure(CreateTable: String; Columns: TTable
ColSpec := Copy(CreateTable, rx.MatchPos[0], SIZE_MB);
ColSpec := Copy(ColSpec, 1, Pos(#10, ColSpec));
ColSpec := Trim(ColSpec);
//Log(lcInfo, '>> '+ColSpec);

Col := TTableColumn.Create(Self);
Columns.Add(Col);
@@ -5238,7 +5222,6 @@ procedure TDBConnection.ParseTableStructure(CreateTable: String; Columns: TTable
end;
Delete(ColSpec, 1, rxCol.MatchLen[1]);
ColSpec := Trim(ColSpec);
//Log(lcInfo, ' Detected DefaultText: "'+Col.DefaultText+'" Detected DefaultType: '+Integer(Col.DefaultType).ToString);

// Do the same for a potentially existing ON UPDATE clause
if ColSpec.StartsWith('ON UPDATE ', True) then begin
@@ -5250,7 +5233,6 @@ procedure TDBConnection.ParseTableStructure(CreateTable: String; Columns: TTable
Col.OnUpdateText := Col.OnUpdateText.TrimRight([',']);
Col.OnUpdateType := cdtExpression;
Delete(ColSpec, 1, rxCol.MatchPos[1]);
//Log(lcInfo, ' Detected OnUpdateText: "'+Col.OnUpdateText+'" Detected OnUpdateType: '+Integer(Col.OnUpdateType).ToString);
end;
end;

@@ -5726,7 +5708,6 @@ procedure TMySQLQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1
FColumnNames.Clear;
FColumnOrgNames.Clear;
for i:=0 to NumFields-1 do begin
//Field := FConnection.Lib.mysql_fetch_field_direct(LastResult, i);
Field := FConnection.Lib.mysql_fetch_field_direct(LastResult, i);
FColumnNames.Add(Connection.DecodeAPIString(Field.name));
if Connection.ServerVersionInt >= 40100 then
@@ -5737,7 +5718,6 @@ procedure TMySQLQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1
FColumnTypes[i] := FConnection.Datatypes[0];
if (Field.flags and AUTO_INCREMENT_FLAG) = AUTO_INCREMENT_FLAG then
FAutoIncrementColumn := i;
//FConnection.Log(lcDebug, 'Field._type: '+Field._type.ToString);
for j:=0 to High(FConnection.Datatypes) do begin
if (Field.flags and ENUM_FLAG) = ENUM_FLAG then begin
if FConnection.Datatypes[j].Index = dtEnum then
@@ -7101,10 +7081,8 @@ function TDBQuery.GetKeyColumns: TStringList;
Result := Connection.GetKeyColumns(FColumns, FKeys);
if Result.Count = 0 then begin
// No good key found. Just expect all columns to be present.
// .. at least of it's not MemSQL, who does not support a later added LIMIT
// SQL Error (1749): Feature 'UPDATE...LIMIT must be constrained to a single partition' is not supported by MemSQL Distributed
for i:=0 to FColumns.Count-1 do
Result.Add(FColumns[i].Name);
for i:=0 to FColumns.Count-1 do
Result.Add(FColumns[i].Name);
end;
end;

0 comments on commit 82241e7

Please sign in to comment.
You can’t perform that action at this time.