mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 18:10:17 +02:00
+ Add explicit Port for mysql connection
git-svn-id: trunk@14771 -
This commit is contained in:
parent
69dedbfaeb
commit
d5f0cc1f7d
@ -65,6 +65,7 @@ TConfigOpt = (
|
||||
soHost,
|
||||
coUserName,
|
||||
coPassword,
|
||||
coPort,
|
||||
coLogFile,
|
||||
coOS,
|
||||
coCPU,
|
||||
@ -86,6 +87,7 @@ ConfigStrings : Array [TConfigOpt] of string = (
|
||||
'host',
|
||||
'username',
|
||||
'password',
|
||||
'port',
|
||||
'logfile',
|
||||
'os',
|
||||
'cpu',
|
||||
@ -101,7 +103,7 @@ ConfigStrings : Array [TConfigOpt] of string = (
|
||||
);
|
||||
|
||||
ConfigOpts : Array[TConfigOpt] of char
|
||||
= ('d','h','u','p','l','o','c','a','v','t','s','m','C','S','r','V');
|
||||
= ('d','h','u','p','P','l','o','c','a','v','t','s','m','C','S','r','V');
|
||||
|
||||
Var
|
||||
TestOS,
|
||||
@ -112,6 +114,7 @@ Var
|
||||
HostName,
|
||||
UserName,
|
||||
Password,
|
||||
Port,
|
||||
LogFileName,
|
||||
Submitter,
|
||||
Machine,
|
||||
@ -127,12 +130,13 @@ begin
|
||||
soHost : HostName:=Value;
|
||||
coUserName : UserName:=Value;
|
||||
coPassword : Password:=Value;
|
||||
coPort : Port:=Value;
|
||||
coLogFile : LogFileName:=Value;
|
||||
coOS : TestOS:=Value;
|
||||
coCPU : TestCPU:=Value;
|
||||
coCategory : TestCategory:=Value;
|
||||
coVersion : TestVersion:=Value;
|
||||
coDate :
|
||||
coDate :
|
||||
begin
|
||||
{ Formated like YYYYMMDDhhmm }
|
||||
if Length(value)=12 then
|
||||
@ -145,7 +149,7 @@ begin
|
||||
TestDate:=EncodeDate(year,month,day)+EncodeTime(hour,min,0,0);
|
||||
end
|
||||
else
|
||||
Verbose(V_Error,'Error in date format, use YYYYMMDDhhmm');
|
||||
Verbose(V_Error,'Error in date format, use YYYYMMDDhhmm');
|
||||
end;
|
||||
coSubmitter : Submitter:=Value;
|
||||
coMachine : Machine:=Value;
|
||||
@ -362,7 +366,7 @@ begin
|
||||
TestLog:=GetExecuteLog(Line);
|
||||
if pos(failed_to_compile,TestLog)=1 then
|
||||
TestLog:=GetLog(Line);
|
||||
end
|
||||
end
|
||||
else
|
||||
TestLog:='';
|
||||
AddTestResult(ID,TestRunID,Ord(TS),TestOK[TS],TestSkipped[TS],TestLog);
|
||||
@ -397,7 +401,7 @@ begin
|
||||
ProcessCommandLine;
|
||||
If LogFileName<>'' then
|
||||
begin
|
||||
ConnectToDatabase(DatabaseName,HostName,UserName,Password);
|
||||
ConnectToDatabase(DatabaseName,HostName,UserName,Password,Port);
|
||||
GetIDs;
|
||||
ProcessFile(LogFileName);
|
||||
UpdateTestRun;
|
||||
|
@ -10,7 +10,7 @@ Uses
|
||||
mysql4,
|
||||
{$else}
|
||||
mysql,
|
||||
{$endif}
|
||||
{$endif}
|
||||
testu;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
@ -40,7 +40,7 @@ Function CleanTestRun(ID : Integer) : Boolean;
|
||||
Type
|
||||
TQueryResult = PMYSQL_RES;
|
||||
|
||||
Function ConnectToDatabase(DatabaseName,Host,User,Password : String) : Boolean;
|
||||
Function ConnectToDatabase(DatabaseName,Host,User,Password,Port : String) : Boolean;
|
||||
Procedure DisconnectDatabase;
|
||||
Function RunQuery (Qry : String; Var res : TQueryResult) : Boolean ;
|
||||
Procedure FreeQueryResult (Res : TQueryResult);
|
||||
@ -67,19 +67,26 @@ Var
|
||||
Connection : TMYSQL;
|
||||
|
||||
|
||||
Function ConnectToDatabase(DatabaseName,Host,User,Password : String) : Boolean;
|
||||
Function ConnectToDatabase(DatabaseName,Host,User,Password,Port : String) : Boolean;
|
||||
|
||||
Var
|
||||
S : String;
|
||||
|
||||
PortNb : longint;
|
||||
Error : word;
|
||||
begin
|
||||
Verbose(V_DEBUG,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Password);
|
||||
{$ifdef ver1_0}
|
||||
Verbose(V_DEBUG,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Password+' '+Port);
|
||||
if Port<>'' then
|
||||
begin
|
||||
Val(Port,PortNb,Error);
|
||||
if Error<>0 then
|
||||
PortNb:=0;
|
||||
end;
|
||||
{$ifdef ver1_0}
|
||||
Result:=mysql_connect(@Connection,PChar(Host),PChar(User),PChar(Password))<>Nil;
|
||||
{$else}
|
||||
{$else}
|
||||
mysql_init(@Connection);
|
||||
Result:=mysql_real_connect(@Connection,PChar(Host),PChar(User),PChar(Password),Nil,0,Nil,0)<>Nil;
|
||||
{$endif}
|
||||
Result:=mysql_real_connect(@Connection,PChar(Host),PChar(User),PChar(Password),Nil,PortNb,Nil,0)<>Nil;
|
||||
{$endif}
|
||||
If Not Result then
|
||||
begin
|
||||
S:=Strpas(mysql_error(@connection));
|
||||
@ -294,7 +301,7 @@ begin
|
||||
else if FileExists(FileName+'.pp') then
|
||||
FileName := FileName + '.pp'
|
||||
else exit;
|
||||
|
||||
|
||||
Verbose(V_Debug,'Reading '+FileName);
|
||||
assign(t,FileName);
|
||||
{$I-}
|
||||
|
Loading…
Reference in New Issue
Block a user