On Mon, 24 Jun 2013 16:34:30 +0100, "Martin J. Evans" <boh...@ntlworld.com> wrote:
> On 24/06/13 16:01, H.Merijn Brand wrote: > > In the git branch "f_dir-ref" (a wrong name now, as we changed some > > things in the development process), you can find a new extension > > > > DBD::File now understands a new attribute f_dir_search: > > > > f_dir_search > > > > This optional attribute can be set to pass a list of folders to also > > find existing tables. It will not be used to create new files. > > That does not make sense to me. Does it really mean: > > This optional attribute can be set to a list of folders which will be > searched for existing tables and is not used when creating new tables. I read exactly the same. I have no objection to this other phrasing if that makes thing clearer. > BTW, I presume you normally use the word folder (bit of a Windows > thing) rather than directory (f_dir_search also suggests directory not > folder). Funny. I started of using f_dir_ext as in extending the dir tree for using tables, but Jens insisted on f_dir_search for Windows users iirc. Folders and directories are the same to me. > > f_dir_search => [ "/data/bar/csv", "/dump/blargh/data" ], > > > > A real-world example might explain this in more detail using DBD::CSV > > > > my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { > > f_schema => undef, > > f_dir => "tmp", > > f_dir_search => [ "sandbox", "/tmp" ], > > f_ext => ".csv/r", > > f_lock => 2, > > f_encoding => "utf8", > > > > RaiseError => 1, > > PrintError => 1, > > FetchHashKeyName => "NAME_lc", > > }) or die "$DBI::errstr\n"; > > > > This will set the default folder for CSV files to be located in the > > folder "tmp". This folder will also be used for creating tables. > > > > When opening a handle to an already existing table, and that table's > > file(s) cannot be found in the folder indicated by "f_dir", the folders > > in the "f_dir"search" (if present) will be searched for the files > > needed to open the table. > > > > my $sth = $dbh->prepare ("select * from foo"); > > > > will, using the above example, search for > > > > tmp/foo.csv > > sandbox/foo.csv > > /tmp/foo.csv > > > > The DBI test suite tests this option in t/51dbm_file.t > > > > If people have feedback, it would be appreciated. Both possitive and > > negative. If no objections exist, I'd like to merge this branch into > > master and request a new release, so we can release DBD::CSV shortly > > after > > > > Martin -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/