public static function queryRowFromTable(
        $db,
        $table,
        $fields,
        $id_field,
        $id
    ) {
        self::initFields($fields);
        $id_field = new SwatDBField($id_field, 'integer');
        $sql = 'select %s from %s where %s = %s';
        $field_list = implode(',', self::getFieldNameArray($fields));

        $sql = sprintf(
            $sql,
            $field_list,
            $table,
            $id_field->name,
            $db->quote($id, $id_field->type)
        );

        $rs = self::query($db, $sql, null);
        $row = $rs->fetchRow(MDB2_FETCHMODE_OBJECT);

        if (MDB2::isError($row)) {
            throw new SwatDBException($row);
        }

        return $row;
    }