diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2012-05-31 09:17:32 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2012-05-31 09:17:32 +0000 |
commit | 1f7f75d7eae32bfb1174140b7d405b9c822f60f2 (patch) | |
tree | a2bbda99f14194f63ebd6b7118fe299fa880660e /scripts/vendorid/insert_vendors.php | |
parent | 3bc07dabc797c7acdeafed68cf63c77c48077005 (diff) |
improved the scripts to update the vendors list from pci.ids and usb.ids
Diffstat (limited to 'scripts/vendorid/insert_vendors.php')
-rw-r--r-- | scripts/vendorid/insert_vendors.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/vendorid/insert_vendors.php b/scripts/vendorid/insert_vendors.php index 27b8307..f2d6eeb 100644 --- a/scripts/vendorid/insert_vendors.php +++ b/scripts/vendorid/insert_vendors.php @@ -17,7 +17,11 @@ while (($line = fgets($ids_fp)) !== false) { $full_name = sanitizeDb(decode_soft($matches[2])); $clean_name = sanitizeDb(decode($matches[2])); // echo "$vendorid $full_name $clean_name".PHP_EOL; - $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('pci','$vendorid','$clean_name','$full_name');"; + //insert + $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('PCI','$vendorid','$clean_name','$full_name');"; + DB::$instance->query($query); + //update + $query = "UPDATE vendors SET clean_name='$clean_name', full_name='$full_name' WHERE vendorid='$vendorid' AND bus='PCI';"; DB::$instance->query($query); } } @@ -34,7 +38,11 @@ while (($line = fgets($ids_fp)) !== false) { $full_name = sanitizeDb(decode_soft($matches[2])); $clean_name = sanitizeDb(decode($matches[2])); // echo "$vendorid $full_name $clean_name".PHP_EOL; - $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('usb','$vendorid','$clean_name','$full_name');"; + //insert + $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('USB','$vendorid','$clean_name','$full_name');"; + DB::$instance->query($query); + //update + $query = "UPDATE vendors SET clean_name='$clean_name', full_name='$full_name' WHERE vendorid='$vendorid' AND bus='USB';"; DB::$instance->query($query); } } |