@@ -21,25 +21,27 @@ name varchar(255) PRIMARY KEY,
21
21
access_key varchar(255),
22
22
companies text ARRAY,
23
23
solved_questions int,
24
- time_to_update timestamp
24
+ time_to_update timestamp,
25
+ being_processed BOOLEAN
25
26
);
26
27
END IF;
27
28
END $$;
28
29
""" ;
29
30
private static final String UPDATE_USER_DETAILS = """
30
- INSERT INTO user_details (name, access_key, companies, solved_questions, time_to_update)
31
+ INSERT INTO user_details (name, access_key, companies, solved_questions, time_to_update, being_processed )
31
32
VALUES
32
33
(
33
34
?,
34
35
?,
35
36
?,
36
37
0,
37
- now() AT TIME ZONE 'UTC'
38
+ now() AT TIME ZONE 'UTC',
39
+ FALSE
38
40
)
39
41
ON CONFLICT (name)
40
42
DO
41
43
UPDATE
42
- SET name=?, access_key=?, companies=?, time_to_update=now() AT TIME ZONE 'UTC';
44
+ SET name=?, access_key=?, companies=?, time_to_update=now() AT TIME ZONE 'UTC', being_processed=FALSE ;
43
45
""" ;
44
46
private static final Logger logger = LoggerFactory .getLogger (PostgresHandler .class );
45
47
private static final String DB_NAME = "leetcode-rs" ;
@@ -71,8 +73,7 @@ protected void initializeUserTable() {
71
73
}
72
74
73
75
public boolean updateUserDetails (UserDetails userDetails ) {
74
- try (Connection connection = ds .getConnection ()) {
75
- var statement = connection .prepareStatement (UPDATE_USER_DETAILS );
76
+ try (Connection connection = ds .getConnection (); var statement = connection .prepareStatement (UPDATE_USER_DETAILS )) {
76
77
statement .setString (1 , userDetails .name ());
77
78
statement .setString (4 , userDetails .name ());
78
79
statement .setString (2 , userDetails .token ());
0 commit comments