diff options
author | Urban Müller | 2012-02-29 13:55:19 +0000 |
---|---|---|
committer | Urban Müller | 2012-02-29 13:55:19 +0000 |
commit | fca15328ed73646d809fb9ab767c7f7928aaff62 (patch) | |
tree | 1bbc2abc124f9200227084730588892ec9e2032b | |
parent | dfa339276ba33417567d19a42214ecad50d68992 (diff) | |
download | itools-fca15328ed73646d809fb9ab767c7f7928aaff62.tar.gz itools-fca15328ed73646d809fb9ab767c7f7928aaff62.tar.bz2 itools-fca15328ed73646d809fb9ab767c7f7928aaff62.zip |
handle schema with empty column names
-rw-r--r-- | it_pipe.class | 2 |
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'); |