Changes between Version 40 and Version 41 of Internal/InventoryV3


Ignore:
Timestamp:
Jan 19, 2011, 2:48:10 AM (13 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/InventoryV3

    v40 v41  
    55Versions:
    66
    7  * gather.rb:2.17
     7 * gather.rb:2.18
    88 * writer.rb:1.02 (deprecated)
    99 * logcopy:0.04 (deprecated)
     
    385385
    386386The component sql_insert and sql_update methods have been added. I might reconsider how I pass parameters in the latter since I'd have to fold things into a hash before I passed them up, it might be cleaner to use a 2 arrays and zip them, rather than passing a hash. Now the update method needs to be redone
     387
     388=== 1/18/2011 ===
     389
     390I've made a couple of big changes.
     391 * there is now a device sub class of component which network and usb should be subclasses of.
     392   It implements the get_device_kind method which takes the identifying numbers and search for the device_kind, if the kind is missing, it will insert it
     393   into the table and then pull the kind_id back from the table.
     394  * It could be argued that the current implementation of get_device_kind requires too many parameters (vendor, device, desc, bus, inv_id), but I can't think
     395    of a cleaner way to pass that information, they're all device dependant.
     396 * heavily modified the update method on network class. It pulls an array of arrays (1 for each interface) from sql via an map(sql_query()) call, it then form a similarly
     397   structured gathered array (which uses the newly implemented get_device_kind method). I use a collection of zips and maps to compare the arrays and make an array
     398   of booleans 1 for each interface. Since I'm using the Array.eql? method to determine if the "data" matches, the match array is type safe because it will always get a
     399   bool. Even if the sql data matrix is empty.  Using the match array I zip the collected information and then push updates and inserts as necessary.
     400   * to make the checks happen I stick with array most of the way down, and only "cast" to a hash if I need to pass a parameter. I use hashes in both insert and update
     401     for uniformity. Really insert could be done properly with 2 array, instead of a hash (thats the way it's used internally any way), but the interface is less cryptic
     402     and the hash processing is done with maps and zips (on the keys array) so it not much diffrent. In the update method I actually use the hash structure.