[Node::Report::Test]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING ( mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW())
    ORDER BY n.mac
    LIMIT 1;
EOT
cursor_type=none
has_limit=disabled

[Node::Report::TestOffset]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW())
    ORDER BY n.mac
    LIMIT ? OFFSET ?;
EOT
bindings=limit,cursor
cursor_type=offset
has_limit=enabled

[Node::Report::TestDateRange]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW()) AND
  n.detect_date BETWEEN ? AND ?
    ORDER BY n.mac
    LIMIT 1;
EOT
bindings=start_date,end_date
cursor_type=none
has_limit=disabled
has_date_range=enabled

[Node::Report::TestDateLimitUndef]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW()) AND
  n.detect_date BETWEEN ? AND ?
    ORDER BY n.mac
    LIMIT 1;
EOT
bindings=start_date,end_date
cursor_type=none
has_limit=disabled
has_date_range=enabled

[Node::Report::TestDateLimit]
type=sql
date_limit=24h
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW()) AND
  n.detect_date BETWEEN ? AND ?
    ORDER BY n.mac
    LIMIT 1;
EOT
bindings=start_date,end_date
cursor_type=none
has_limit=disabled
has_date_range=enabled

[Node::Report::TestFormatting]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    n.mac as mac,
    ip,
    start_time,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  (i.end_time = 0 OR i.end_time > NOW()) AND
  n.detect_date BETWEEN ? AND ?
    ORDER BY n.mac
    LIMIT 1;
EOT
bindings=start_date,end_date
cursor_type=none
formatting=vendor:oui_to_vendor
has_limit=disabled
has_date_range=enabled
[Node::Report::TestMultiValueCursor]
type=sql
description=<<EOT
First node
EOT
columns=mac, ip, start_time, pid, detect_date, regdate, status, user_agent, computername, notes, last_arp, last_dhcp, os
sql=<<EOT
  SELECT
    mac,
    pid,
    detect_date,
    regdate,
    status,
    user_agent,
    computername,
    notes,
    last_arp,
    last_dhcp,
    device_type AS os
  FROM node n LEFT JOIN ip4log i USING (mac)
  WHERE
  detect_date BETWEEN ? AND ? AND
  (detect_date, mac) >= (?, ?)
    ORDER BY n.detect_date, n.mac
    LIMIT ?;
END;
EOT
bindings=start_date,end_date,cursor.0,cursor.1,limit
cursor_type=multi_field
cursor_field=detect_date,mac
cursor_default=0000-01-01 00:00:00,00:00:00:00:00:00
has_limit=enabled
has_date_range=enabled
