|
@@ -28,7 +28,7 @@ Function AddTest(Name : String; AddSource : Boolean) : Integer;
|
|
|
Function UpdateTest(ID : Integer; Info : TConfig; Source : String) : Boolean;
|
|
|
Function AddTestResult(TestID,RunID,TestRes : Integer;
|
|
|
OK, Skipped : Boolean;
|
|
|
- Log : String) : Integer;
|
|
|
+ Log : String;var is_new : boolean) : Integer;
|
|
|
Function RequireTestID(Name : String): Integer;
|
|
|
Function CleanTestRun(ID : Integer) : Boolean;
|
|
|
|
|
@@ -121,6 +121,19 @@ begin
|
|
|
Res:=Mysql_store_result(@connection);
|
|
|
end;
|
|
|
|
|
|
+{ No warning if it fails }
|
|
|
+Function RunSilentQuery (Qry : String; Var res : TQueryResult) : Boolean ;
|
|
|
+
|
|
|
+begin
|
|
|
+ Verbose(V_DEBUG,'Running silent query:'+Qry);
|
|
|
+ Result:=mysql_query(@Connection,PChar(qry))=0;
|
|
|
+ If Not Result then
|
|
|
+ Verbose(V_DEBUG,'Silent query : '+Qry+'Failed : '+Strpas(mysql_error(@connection)))
|
|
|
+ else
|
|
|
+ Res:=Mysql_store_result(@connection);
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
Function GetResultField (Res : TQueryResult; Id : Integer) : String;
|
|
|
|
|
|
Var
|
|
@@ -410,34 +423,45 @@ end;
|
|
|
|
|
|
Function AddTestResult(TestID,RunID,TestRes : Integer;
|
|
|
OK, Skipped : Boolean;
|
|
|
- Log : String) : Integer;
|
|
|
+ Log : String;var is_new : boolean) : Integer;
|
|
|
|
|
|
Const
|
|
|
SInsertRes='Insert into TESTRESULTS '+
|
|
|
'(TR_TEST_FK,TR_TESTRUN_FK,TR_OK,TR_SKIP,TR_RESULT) '+
|
|
|
' VALUES '+
|
|
|
'(%d,%d,"%s","%s",%d) ';
|
|
|
- SInsertLog='Update TESTRESULTS SET TR_LOG="%s" WHERE (TR_ID=%d)';
|
|
|
+ SSelectId='SELECT TR_ID FROM TESTRESULTS WHERE (TR_TEST_FK=%d) '+
|
|
|
+ ' AND (TR_TESTRUN_FK=%d)';
|
|
|
+ SInsertLog='Update TESTRESULTS SET TR_LOG="%s"'+
|
|
|
+ ',TR_OK="%s",TR_SKIP="%s",TR_RESULT=%d WHERE (TR_ID=%d)';
|
|
|
Var
|
|
|
Qry : String;
|
|
|
Res : TQueryResult;
|
|
|
-
|
|
|
+ updateValues : boolean;
|
|
|
begin
|
|
|
+ updateValues:=false;
|
|
|
Result:=-1;
|
|
|
Qry:=Format(SInsertRes,
|
|
|
[TestID,RunID,B[OK],B[Skipped],TestRes,EscapeSQL(Log)]);
|
|
|
- If RunQuery(Qry,Res) then
|
|
|
+ If RunSilentQuery(Qry,Res) then
|
|
|
Result:=mysql_insert_id(@connection)
|
|
|
else
|
|
|
- Verbose(V_Warning,'AddTestResult failed');
|
|
|
- if (Result<>-1) and (Log<>'') then
|
|
|
begin
|
|
|
- Qry:=format(SInsertLog,[EscapeSQL(Log),Result]);
|
|
|
+ Qry:=format(SSelectId,[TestId,RunId]);
|
|
|
+ Result:=IDQuery(Qry);
|
|
|
+ if Result<>-1 then
|
|
|
+ updateValues:=true;
|
|
|
+ end;
|
|
|
+ if (Result<>-1) and ((Log<>'') or updateValues) then
|
|
|
+ begin
|
|
|
+ Qry:=format(SInsertLog,[EscapeSQL(Log),B[OK],B[Skipped],TestRes,Result]);
|
|
|
if not RunQuery(Qry,Res) then
|
|
|
begin
|
|
|
Verbose(V_Warning,'Insert Log failed');
|
|
|
end;
|
|
|
end;
|
|
|
+ { If test already existed, return false for is_new to avoid double counting }
|
|
|
+ is_new:=not updateValues;
|
|
|
end;
|
|
|
|
|
|
Function RequireTestID(Name : String): Integer;
|