package RDG;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import javax.sql.DataSource;
import org.postgresql.ds.PGSimpleDataSource;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Marcel
 */
public class UsersDB {
    /**
    * check if user exists
    * @param user_id user_id to check
    * @throws SQLException
    * @throws boolean if user exists
    */
    public static boolean exists(int user_id) throws SQLException {
        PreparedStatement s = RDG.DbContext.getConnection().prepareStatement("SELECT * from users WHERE user_id=?");
        s.setInt(1, user_id);
        return s.executeQuery().next();
    }
}
