summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2020-07-02 16:18:07 +0200
committerUrban Müller2020-07-02 16:18:07 +0200
commit66baf45169a903fc18352ae49c1febefd7381fdf (patch)
tree9c6674190c8a4a6ecbc3386dd437cb99a58a6881
parent8653a997c8b4d766f7fb4f6c1888cd0a1ea85cd9 (diff)
downloaditools-66baf45169a903fc18352ae49c1febefd7381fdf.tar.gz
itools-66baf45169a903fc18352ae49c1febefd7381fdf.tar.bz2
itools-66baf45169a903fc18352ae49c1febefd7381fdf.zip
dont return partial results
-rw-r--r--it_pipe.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class
index e009556..1c890a8 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -196,6 +196,7 @@ function cols($collist, $separator = "\t")
* @param $p['forceschema'] ignore schema in file, replace it with this comma separated column list
* @param $p['fixcolnames'] replace non-identifier chars in colum names
* @param $p['it_error'] error params
+ * @return array of objects or empty array on format violations
*/
function csv($p = [])
{
@@ -215,7 +216,7 @@ function csv($p = [])
if (($cols = str_getcsv($line, $splitchar, '"')) && count($schema) == count($cols))
$records[] = (object)array_combine($schema, $cols);
else
- it::error((array)$p['it_error'] + ['title' => "schema mismatch: " . count($schema) . " vs " . count($cols), 'body' => [$schema, $line]]);
+ return (array)it::error((array)$p['it_error'] + ['title' => "schema mismatch: " . count($schema) . " vs " . count($cols), 'body' => [$schema, $line]]);
}
setlocale(LC_CTYPE, $oldlocale);