mac_track_ports double

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
killonik
Posts: 2
Joined: Thu Oct 31, 2013 4:30 am

mac_track_ports double

Post by killonik »

Hello everyone.
I need to make a copy of the table mac_track_ports.
I inserted the code into poller_mactrack.php

Code: Select all

db_execute("INSERT INTO mac_track_ports 
    (site_id, device_id, hostname, dns_hostname, device_name, 
    vlan_id, vlan_name, mac_address, vendor_mac, ip_address, 
    port_number, port_name, scan_date, authorized) 
    SELECT site_id, device_id, hostname, dns_hostname, device_name, 
    vlan_id, vlan_name, mac_address, vendor_mac, ip_address, 
    port_number, port_name, scan_date, authorized 
    FROM mac_track_temp_ports 
    ON DUPLICATE KEY UPDATE site_id=VALUES(site_id), hostname=VALUES(hostname), 
    device_name=VALUES(device_name), vlan_id=VALUES(vlan_id), vlan_name=VALUES(vlan_name), 
    vendor_mac=VALUES(vendor_mac), ip_address=VALUES(ip_address), dns_hostname=VALUES(dns_hostname), 
    port_name=VALUES(port_name), authorized=VALUES(authorized)");
db_execute("INSERT INTO mac_track_ports_double 
    (site_id, device_id, hostname, dns_hostname, device_name, 
    vlan_id, vlan_name, mac_address, vendor_mac, ip_address, 
    port_number, port_name, scan_date, authorized) 
    SELECT site_id, device_id, hostname, dns_hostname, device_name, 
    vlan_id, vlan_name, mac_address, vendor_mac, ip_address, 
    port_number, port_name, scan_date, authorized 
    FROM mac_track_temp_ports 
    ON DUPLICATE KEY UPDATE site_id=VALUES(site_id), hostname=VALUES(hostname), 
    device_name=VALUES(device_name), vlan_id=VALUES(vlan_id), vlan_name=VALUES(vlan_name), 
    vendor_mac=VALUES(vendor_mac), ip_address=VALUES(ip_address), dns_hostname=VALUES(dns_hostname), 
    port_name=VALUES(port_name), authorized=VALUES(authorized)");
mac_track_ports - filling
mac_track_ports_double - no

I checked the permissions on new mysql table - all is OK.

help!
killonik
Posts: 2
Joined: Thu Oct 31, 2013 4:30 am

Re: mac_track_ports double

Post by killonik »

problem solved.
I've done trigger "BEFORE INSERT INTO mac_track_ports" that fills the doubling table.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest