Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankmmmx committed May 19, 2016
1 parent cb0863a commit b648566
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified lib/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion src/DataConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static Connection createConnection() throws SQLException
if(connection == null)
{
connection = DriverManager.getConnection(databaseURL, Constants.USERNAME, Constants.PASSWORD);
System.out.println("Connected.");
}

return connection;
Expand Down
10 changes: 5 additions & 5 deletions src/DatabaseUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Calendar;

public class DatabaseUtility {

/*
* Gets user using cardID as parameter
* Returns User object
Expand All @@ -30,16 +30,16 @@ public static User getUser(String cardID) throws SQLException
/*
* Inserts new user into database and updates points
*/
public static void insertNewUser(User user, int points) throws SQLException
public static void insertNewUser(String cardID, String accessID, int points) throws SQLException
{
Connection connection = DataConnection.createConnection();
Timestamp currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());

String sql = "INSERT into points_fall_16 (cardID, accessID, points, last_checkin) values (?, ?, ?, ?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, user.getCardID());
statement.setString(2, user.getAccessID());
statement.setInt(3, (user.getPoints() + points));
statement.setString(1, cardID);
statement.setString(2, accessID);
statement.setInt(3, points);
statement.setTimestamp(4, currentTimestamp);
statement.executeUpdate();
}
Expand Down

0 comments on commit b648566

Please sign in to comment.