package ru.yandex.wmconsole.service.dao;

import ru.yandex.wmconsole.data.partition.WMCPartition;
import ru.yandex.wmtools.common.error.InternalException;
import ru.yandex.wmtools.common.service.AbstractDbService;

/**
 * User: azakharov
 * Date: 30.12.13
 * Time: 13:28
 */
public class TblHostsMainUsersDao extends AbstractDbService {

    public Long getMainUserForHost(final long hostId) throws InternalException {
        final String query = "SELECT hmu.user_id FROM tbl_hosts_main_users hmu WHERE hmu.host_id = ?";
        return getJdbcTemplate(WMCPartition.nullPartition()).safeQueryForLong(query, hostId);
    }
}
