Discussion:
PATCH: Add "FROM" information from the software inventory
Stéphane Urbanovski
2010-01-26 15:03:31 UTC
Permalink
Hello

This patch make the server able to save the "FROM" information from the software inventory

diff -Nur OCSNG_UNIX_SERVER-1.3beta3-orig/Apache/Ocsinventory/Map.pm OCSNG_UNIX_SERVER-1.3beta3/Apache/Ocsinventory/Map.pm
--- OCSNG_UNIX_SERVER-1.3beta3-orig/Apache/Ocsinventory/Map.pm 2009-11-20 22:32:37.000000000 +0100
+++ OCSNG_UNIX_SERVER-1.3beta3/Apache/Ocsinventory/Map.pm 2010-01-26 15:54:52.000000000 +0100
@@ -360,7 +360,8 @@
COMMENTS => {},
FILENAME => {},
FILESIZE => { fallback=>0 },
- SOURCE => { fallback=>0 }
+ SOURCE => { fallback=>0 },
+ FROM => {}
}
},



Associated SQL patch :
ALTER TABLE `softwares` ADD `FROM` VARCHAR( 64 ) NOT NULL ;






This patch add quotes to the field list part of the sql request (allow us to use reserved word in field names):

diff -Nur OCSNG_UNIX_SERVER-1.3beta3-orig/Apache/Ocsinventory/Server/Inventory/Data.pm OCSNG_UNIX_SERVER-1.3beta3/Apache/Ocsinventory/Server/Inventory/Data.pm
--- OCSNG_UNIX_SERVER-1.3beta3-orig/Apache/Ocsinventory/Server/Inventory/Data.pm 2009-11-20 22:32:37.000000000 +0100
+++ OCSNG_UNIX_SERVER-1.3beta3/Apache/Ocsinventory/Server/Inventory/Data.pm 2010-01-26 15:54:07.000000000 +0100
@@ -77,7 +77,7 @@
$field_index++;
}
# Build the "DBI->prepare" sql insert string
- $fields_string = join ',', ('HARDWARE_ID', @{$sectionsMeta->{$section}->{field_arrayref}});
+ $fields_string = '`'.(join '`,`', ('HARDWARE_ID', @{$sectionsMeta->{$section}->{field_arrayref}})).'`';
$sectionsMeta->{$section}->{sql_insert_string} = "INSERT INTO $section($fields_string) VALUES(";
for(0..@{$sectionsMeta->{$section}->{field_arrayref}}){
push @bind_num, '?';

Regards
--
Stéphane Urbanovski
Gonéri Le Bouder
2010-01-26 15:14:48 UTC
Permalink
Post by Stéphane Urbanovski
Hello
This patch make the server able to save the "FROM" information from the software inventory
Commited. Thank you.
--
Gonéri Le Bouder
Loading...