MySQL Stored procedure calculation report

Source: Internet
Author: User

Summarize the MySQL table of use case execution.

DELIMITER $$ Use' test_cases ' $$DROP PROCEDURE IF EXISTS' P_write_report_3 ' $$CREATEDefiner=' Root ' @ ' localhost 'PROCEDURE' P_write_report_3 ' (inchP_table_nameVARCHAR( the),inchP_class_nameVARCHAR( the),inchP_method_nameVARCHAR( the),inchP_execution_flagVARCHAR( the))BEGIN           DECLAREVar_cass_nameVARCHAR( the)DEFAULT NULL;--Test class name    DECLAREVar_method_nameVARCHAR( the)DEFAULT NULL;--test Method Name    DECLAREVar_moduleVARCHAR( the)DEFAULT NULL;--Test Module Chinese    DECLAREVar_case_nameINT DEFAULT 0;--test Case name Chinese    DECLAREVar_pass_amountINT DEFAULT 0;--by the number of use cases    DECLAREVar_fail_reasonVARCHAR( $)DEFAULT NULL;--Reason for failure    DECLAREVar_commentVARCHAR( $)DEFAULT NULL;--Notes    DECLAREVar_sql_stringVARCHAR( $)DEFAULT NULL;--SQL statements        SET @var_cass_name =P_class_name; SET @var_method_name =P_method_name; SET @var_sql_string =CONCAT ("Select *  from", P_table_name,"whereTest_method= '", P_method_name,"'  andExecution_flag= '", P_execution_flag,"'  andTest_class= '", P_class_name,"'  andIs_select= 1  andIs_pass= 1 "); SELECT  @var_sql_string; Call P_get_select_row_number (@var_sql_string,@var_pass_amount); SELECT @var_pass_amount; SET @var_sql_string =CONCAT ("Select *  from", P_table_name,"whereTest_method= '", P_method_name,"'  andExecution_flag= '", P_execution_flag,"'  andTest_class= '", P_class_name,"'  andIs_select= 1  andIs_pass= 0 "); SELECT  @var_sql_string; Call P_get_select_row_number (@var_sql_string,@var_fail_reason); SELECT @var_fail_reason; SELECTGroup_concat (Fail_reason) into @fail_reason  fromReport LIMITTen; IF(SELECT COUNT(*) fromReportWHEREExecution_flag=P_execution_flag andClass_name=P_class_name andMethod_name=P_method_name) Then      UPDATEReportSETExecution_amount=  A, Pass_amount=  A, Fail_amount=  A, Fail_reason= '111', COMMENT= '1111', Time=Now ()WHEREExecution_flag= 201603301554  andClass_name=P_class_name andMethod_name=P_method_name; SELECTTrue,var_fail_reason, now (); ELSE              INSERT   intoReport (' Execution_flag ', ' class_name ', ' method_name ', ' module ', ' Case_name ', ' execution_amount ', ' pass_amount ', ' Fail_amount ', ' Fail_reason ', ' time ', ' comment ')VALUES(P_execution_flag,p_class_name,'Insertresult','Darkroom Lights','is', A, at,     -,'oooooo', now (),'ssss'); SELECTFalse,var_fail_reason, now (); END IF; END$ $DELIMITER; Call P_write_report_3 ('Execution_remote_open','Com.fc.htgl.testcases.TestRemoteOpen','Testcustomergetexpresserror','201604061017');SELECT *  fromReportORDER  byreport_idDESC;SELECT *  fromExecution_remote_openORDER  byexecution_idDESC;

MySQL Stored procedure calculation report

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.