summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
authorUrban Müller2012-02-29 13:55:19 +0000
committerUrban Müller2012-02-29 13:55:19 +0000
commitfca15328ed73646d809fb9ab767c7f7928aaff62 (patch)
tree1bbc2abc124f9200227084730588892ec9e2032b /it_pipe.class
parentdfa339276ba33417567d19a42214ecad50d68992 (diff)
downloaditools-fca15328ed73646d809fb9ab767c7f7928aaff62.tar.gz
itools-fca15328ed73646d809fb9ab767c7f7928aaff62.tar.bz2
itools-fca15328ed73646d809fb9ab767c7f7928aaff62.zip
handle schema with empty column names
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class2
1 files changed, 2 insertions, 0 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 6847a5d..d002b5b 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -154,6 +154,8 @@ function csv()
$counts = count_chars($this->lines[0]);
$splitchar = $counts[ord("\t")] ? "\t" : ($counts[ord(";")] > $counts[ord(",")] ? ";" : ",");
$schema = str_getcsv(trim(array_shift($this->lines), "#\n "), $splitchar, '"'); # could do a function_exists('str_getcsv') here...
+ foreach (preg_grep('/^$/', $schema) as $idx => $dummy)
+ $schema[$idx] = "field$idx";
$oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1');