WIP: Leo/Backend/RegNo #147

Closed
LeoMoulin wants to merge 6 commits from Leo/Backend/RegNo into master
Showing only changes of commit 49b99e14c9 - Show all commits

View File

@ -20,14 +20,15 @@ public class RegNoGenerator implements IdentifierGenerator {
Statement statement = conn.createStatement();
int n = usv.getCount();
String query = "select count(reg_no)+"+n+" from Users";
usv.increment();
Calendar c = new GregorianCalendar();
int y = c.get(Calendar.YEAR);
String query = "select count(reg_no) + "+n+" from Users where reg_no/10000 = " + y%1000;
ResultSet set = statement.executeQuery(query);
long resp = 0;
Calendar c = new GregorianCalendar();
if(set.next()){
resp = set.getLong(1)+((c.get(Calendar.YEAR)%1000)*10000);
resp = set.getLong(1)+((y%1000)*10000);
usv.increment();
}
conn.close();