Commit Diff
Diff:
a14c6cc18b78adee50cb6ec14dd02a7b15e1bf2b
101fa156c6e0d5d4c8049904e5351d9e191f2e1e
Commit:
101fa156c6e0d5d4c8049904e5351d9e191f2e1e
Tree:
f1c077010e7786e213b5bfb97ee4ef9853227a5a
Author:
fredgnix <fredgnix@a8afeb8c-277c-4b4a-a4f6-ef4c85adc32b>
Committer:
fredgnix <fredgnix@a8afeb8c-277c-4b4a-a4f6-ef4c85adc32b>
Date:
Tue Apr 10 13:22:11 2012 UTC
Message:
add some " delimeters for CSV, safer for mysql import
blob - 09d685d1097716940d09844e16e721b7c0144289
blob + 1ea40300e008378de812ec914843021a68f06d0d
--- Pkgtxt2db.pm
+++ Pkgtxt2db.pm
@@ -158,13 +158,13 @@ sub mkdadb {
# CSV
#
sub tocsv {
- open(C, ">$target-$release.csv") or die "Unable to open pkgtxt.csv for writing, aborting.";
+ open(C, ">$target-$release.csv") or die "Unable to open $target-$release.csv for writing, aborting.";
# choose the CSV separator, \t = tab \@ = @ ....
# avoid the comma (,) as it is the separator for dependancies
- my $c = "\;";
- print C "pkgname${c}pkgver${c}arch${c}pkgrel${c}location${c}dep${c}sizeC${c}sizeU${c}Desc\n";
+ my $c = "\"\;\"";
+ print C "\"pkgname${c}pkgver${c}arch${c}pkgrel${c}location${c}dep${c}sizeC${c}sizeU${c}Desc\"\n";
for my $p ( sort keys %pkgdb ) {
- printf C "%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s\n",
+ printf C "\"%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s\"\n",
$p, $pkgdb{$p}[1], $pkgdb{$p}[2], $pkgdb{$p}[3], $pkgdb{$p}[4], $pkgdb{$p}[5], $pkgdb{$p}[6], $pkgdb{$p}[7], $pkgdb{$p}[8];
}
close (C);
Frédéric Galusik