Loadrunner?????????????
???????????? ???????[ 2013/5/15 11:47:54 ] ????????
query_result = mysql_use_result(db_connection);
if (query_result == NULL) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
// ??????????????????????????ε??? mysql_fetch_row ???????NULL
result_row = (char **)mysql_fetch_row(query_result);
if (result_row == NULL) {
lr_error_message("Did not expect the result set to be empty");
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
// ????????????????????????
lr_save_string(result_row[0]?? "paramOrderID");
lr_output_message("Order ID is: %s"?? lr_eval_string("{paramOrderID}"));
mysql_free_result(query_result);
// ????????????????????????InnoDB????
rc = mysql_query(db_connection?? "BEGIN"); //???????
if (rc != 0) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_close(db_connection);
lr_abort();
}
// ??? "FOR UPDATE" ???????μ???????
rc = mysql_query(db_connection?? "SELECT order_id FROM test_data WHERE status IS FALSE LIMIT 1 FOR UPDATE");
if (rc != 0) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_close(db_connection);
lr_abort();
}
query_result = mysql_use_result(db_connection);
if (query_result == NULL) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
result_row = (char **)mysql_fetch_row(query_result);
if (result_row == NULL) {
lr_error_message("??в???????");
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
lr_save_string(result_row[0]?? "paramOrderID");
lr_output_message("Order ID is: %s"?? lr_eval_string("{paramOrderID}"));
mysql_free_result(query_result);
lr_save_string(lr_eval_string("UPDATE test_data SET status=TRUE?? date_used=NOW() WHERE order_id='{paramOrderID}'")??"paramUpdateQuery");
rc = mysql_query(db_connection?? lr_eval_string("{paramUpdateQuery}"));
if (rc != 0) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_close(db_connection);
lr_abort();
}
rc = mysql_query(db_connection?? "COMMIT"); // ??????
if (rc != 0) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_close(db_connection);
lr_abort();
}
// ??β???????????????????????????????????
rc = mysql_query(db_connection?? "SELECT order_id FROM test_data WHERE status IS FALSE LIMIT 1");
if (rc != 0) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_close(db_connection);
lr_abort();
}
query_result = mysql_use_result(db_connection);
if (query_result == NULL) {
lr_error_message("%s"?? mysql_error(db_connection));
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
result_row = (char **)mysql_fetch_row(query_result);
if (result_row == NULL) {
lr_output_message("Result set is empty as expected");
mysql_free_result(query_result);
} else {
lr_error_message("Did not expect the result set to contain any rows");
mysql_free_result(query_result);
mysql_close(db_connection);
lr_abort();
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11