MTSQL HELP:
To disable autocommit mode for a single series of statements, use the START TRANSACTION statement:
START TRANSACTION;
SELECT @A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summary=@A WHERE type=1;
COMMIT;
With START TRANSACTION, autocommit remains disabled until you end the transaction with COMMIT or ROLLBACK. The autocommit mode then reverts to its previous state.
存储过程代码:(以in开头的为输入参数;以out开头的为输出参数)
BEGIN
#out_log_code。-1为异常情况;大于0为返回的正确值
DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
set out_log_code=-1;
start transaction;
insert into login_log_tb(game_id,server_name,account,user_password,login_ip) values (in_game_id,in_server_name,in_account,in_user_password,in_login_ip);#记录日志