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.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 *
 * @author Marcel
 */
public class Companies {
    /**
     * check if company w/ this id exists
     * @param company_id  
     * @throws SQLException
     * @return boolean if company w/ this id exists
     */
    public static boolean exists(int company_id) throws SQLException{
        PreparedStatement s = DbContext.getConnection().prepareStatement("SELECT * from companies WHERE company_id=?");
        s.setInt(1, company_id);
        return s.executeQuery().next();
    }
}
