my problem is easy to explain: In my config file from pure-ftp there is only one INSERT-Statement allowed to read the password. It is like this:
SELECT password FROM ftpuser WHERE userid = "\L"
"\\L" is the placeholder for the userid. It works perfectly, but I need to count the access to the ftp-server. There is a field in this table called "accessed". So I need to run this SQL, too:
UPDATE ftpuser SET accessed = accessed + 1 WHERE userid = "\L"
Is there any way to bring this two statements to one, with "password" as result? Or is there another way to trigger the access from pure-ftp, maybe? Thank you very much!
Sebastian
If it's a question of preserving atomicity, then provided your table is stored using a transactional engine (eg InnoDB), you can wrap the whole thing in a transaction with a locking read :
START TRANSACTION;
SELECT password FROM ftpuser WHERE userid = '\L' FOR UPDATE;
UPDATE ftpuser SET accessed = accessed + 1 WHERE userid = '\L';
COMMIT;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.