简体   繁体   中英

Java- MySQL: Barcode scan to alter field in db

I am new to Java and MySQL, and I want to build my first app. So, I run into a few problems at the start. Two of them to be precise...

I want to make an app (for free), to support a local Board game club, and here is the catch.

The club wants to use Barcode scanner to read barcode in their member's membership cards. This should alter a field in their database, which is 'bit' type, corresponding to member being in the club, or not (with 1 being active, and 0 being away).

Other thing is, the member should be 'active' for the whole day, and his 'activity' should reset at the end of a day. I was thinking of making it a session, but how do I make it expire at the exact time?

Now, I have looked for answers in other questions, but have found nothing of use...

I am here for further clarifications if needed... Thank you in advance :)

The barcode scanner is, for the most part, just a keyboard replacement. Instead of typing the code by hand, the scanner will send the keystrokes for you. You don't really need to do anything about it.

I assume the barcode represents member ID. When your application reads a barcode, it should then do something like this: update members set active=1 where member_id = xxx , with xxx being the barcode.

At the end of the day, you want to check all members out. You'll do something like this: update members set active=0 where active=1 . Depending on your situation, you can either make a button to run this action, or you can make a cron job/task schedule that will run at some fixed time.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM