Assignment: Data File storage Script
We need to define a module called DBConv::DataFileStore which will control storage of a datafile. It will receive column and row information and store it in a universal format and be able to access it again when needed. It should be basically a flat file with a parameterized field and row delimiter and a column name header.
Function 1:
# File doesn't exist- Create File with following arguments
my $d= new DBConv::DataFileStore(data_files_directory => "/whatever", project => "pru2012", db=>"psdw", version=> "source", group => "20120301", set => "ResultsprocedureA", file=> "important_facts"
column_format => [ {name => "foo", type => "TEXT"}, etc], sort => ["foo", "bar"]);
Function 2:
# if file does exist, append data to existing file.
my $d = new DataFileStore(data_files_directory => "/whatever", project => "pru2012", db=>"psdw", version=> "source", group => "20120301", set => "ResultsprocedureA", file=> "important_facts")
Function 3: Compare input data against data file, if data found or same data , it returns 1, else return undef
DataFileStore->compare_same_file((data_files_directory => "/whatever", **consistent-parameters**,
comparison_columns => { **differing parameters** }
Example
DataFileStore->compare_same_file(data_files_directory => "/whatever", project => "pru2012", db=>"psdw", group => "20120301", set => "ResultsprocedureA", file=> "important_facts
comparison_columns => {version => qw(source target)});
returns 1 for equal and undef for not equal