my @lines = ();
my $l;
- #open(STDOUT,">&2");
#
# Store lines and lengths in memory
#
while (<>) {
- #print $_; next;
chomp($_);
- #warn $_;
my @F = split($sep,$_);
for (my $i=0;$i<@F;$i++) {
my $format = "| ".join(" | ",map {$t+=$_+3; "\%-".$_."s"} @len)." |".chr(10);
my $sep_line = "+".join("+",map {("-"x($_+2))} @len)."+".chr(10);
my $tot = @lines - ($noheader ? 0 : 1);
+ #use Data::Dumper; warn Dumper(\@lines);
+ exit unless $tot;
print $sep_line;
# Virtual - NB 04.07.16
foreach ($tables as $name => $t) {
if (empty($t['sql'])) continue;
- $sql = $t['sql']; unset($t['sql']);
+ #$sql = $t['sql']; unset($t['sql']);
$t = $this->table($name,$t);
- $t->sql = $sql;
- $this->tables[] = $t;
+ #$t->sql = $sql;
+ $this->tables[$name] = $t;
}
}
// Extras - We dont want to affect $this
// Type
+ $sql = '';
if (isset($opt['sql'])) {
- unset($opt['type']);
- $this->type = 'sql';
+ $sql = $opt['sql']; unset($opt['sql']);
+ $this->type = 'sql'; unset($opt['type']);
}
// Extras
bye("Query not Allowed !");
}
+ if ($sql) $this->sql = $sql; # from $opt['sql']
# NB 29.03.16 return $this->fields();
}
public function fields($name=null) {
#if (!empty($this->sql)) return []; # Virtual - NB 04.07.16
- if ($this->type == 'sql') return []; # Virtual - NB 04.07.16
+ #if ($this->type == 'sql') return []; # Virtual - NB 04.07.16
if (!isset($this->fields)) {
$this->fields = array();
}
- if (empty($this->fields)) bye("Table `".$this->name."` does not exists");
+ #if (empty($this->fields)) bye("Table `".$this->name."` does not exists");
} # < $this->fields