delimiter // create or replace procedure editmember( in token varchar(100), in userid varchar(100), in username nvarchar(100), in email varchar(100), in pwd varchar(200) ) /* Function : 修改會員資料 Description: 原則: 傳入內容若是空白就不更新 Build Date : 2018/04/12 Modify History Item Who Date Modify Docs ==== ========== ========== ================================================ 1 Michael 2018/01/08 開始改寫為 MySQL 版 */ begin /* 先寫一個簡單的 insert 版本 uuid 寫入驗證碼(ddmmyy) 後面還要再加入判斷檢查的機制, 及 error code 回傳等 .. */ if username <> '' then update sys_users set username = username where userid = userid and username <> username; end if; if email <> '' then update sys_users set email = email where userid = userid and email <> email; end if; if pwd <> '' and pwd <> 'nopwd' then update sys_users set pwd = pwd where userid = userid and pwd <> pwd; end if; -- 回傳 ds1 select 0 as code, '修改會員成功' as msg, 1 as recno; -- 回傳 ds2 select coalesce(userid, '') as userid, coalesce(username, '') as username, coalesce(email, '') as email, token from sys_users where coalesce(token, 'null') = token; end // delimiter ;