'border' => '_',
'head' => 'out_human_head',
'function' => 'out_human',
+ 'end' => function($o) { echo $o['line']."\n"; }
],
'sql' => array(),
if (isset($o['eol'])) echo $o['eol'];
}
- public static function end($o) {
+ public static function end(&$o) {
if (isset($o['enclose'])) echo $o['enclose'][1];
+ if (isset($o['end'])) echo $o['end']($o);
}
public static function rows_get($type,$data,$head=array()) {
# For no scalar search max length
$o['fields_max_len'] = [];
- foreach ($o['data'] as $rec) {
- $i = 0;
+ foreach ($o['data'] as $id=>$rec) {
+ $i = -1;
foreach ($rec as $k=>$v) {
+ $i++;
if (!is_scalar($v)) continue;
if (0
or empty($o['fields_max_len'][$i])
or strlen($v) >= $o['fields_max_len'][$i]
- ) $o['fields_max_len'][$i] = strlen($v);
+ ) $o['fields_max_len'][$i] = mb_strlen($v);
#echo strlen($v)."\n";
- $i++;
}
}
$head = array_keys($head);
}
- $i = 0;
+ $i = -1;
foreach ($head as $k => $v) {
+ $i++;
if (!is_scalar($v)) continue;
if (0
or empty($o['fields_max_len'][$i])
or strlen($v) >= $o['fields_max_len'][$i]
- ) $o['fields_max_len'][$i] = strlen($v);
+ ) $o['fields_max_len'][$i] = mb_strlen($v);
#echo strlen($v)."\n";
- $i++;
}
#debug($line);
$i = 0;
$values = [];
foreach (array_values($row) as $k=>$v) {
- #debug(strlen($v).' == '.$o['fields_max_len'][$i]);
+ #if(mb_strlen($v)!=$o['fields_max_len'][$i]) debug(mb_strlen($v).' == '.$o['fields_max_len'][$i]);
#debug("%".$o['fields_max_len'][$i]."s");
$values[] = sprintf("%".'-'.$o['fields_max_len'][$i]