}
$output .= '{"name":"' . $table['TABLE_NAME'] . '","rowcount":' . $rowCount . '},';
}
if (substr($output, -1) == ",")
$output = substr($output, 0, -1);
$output .= ']';
}
$output .= '},';
}
$output = substr($output, 0, -1);
}
} else if ($this->adapter == "mysql") {
$schemaSql = $this->listDatabases();
if ($this->rowCount($schemaSql)) {
while ($schema = $this->fetchArray($schemaSql)) {
$output .= '{"name": "' . $schema[0] . '"';
$this->selectDB($schema[0]);
$tableSql = $this->listTables();
if ($this->rowCount($tableSql)) {
$output .= ',"items": [';
while ($table = $this->fetchArray($tableSql)) {
$countSql = $this->query("SELECT COUNT(*) AS `RowCount` FROM `" . $table[0] . "`");
$rowCount = (int)($this->result($countSql, 0, "RowCount"));
$output .= '{"name":"' . $table[0] . '","rowcount":' . $rowCount . '},';
}
if (substr($output, -1) == ",")
$output = substr($output, 0, -1);
$output .= ']';
}
$output .= '},';
}
$output = substr($output, 0, -1);
}
} else if ($this->adapter == "sqlite") {
$output .= '{"name": "' . $this->db . '"';
$tableSql = $this->listTables();
if ($tableSql) {
$output .= ',"items": [';
while ($tableRow = $this->fetchArray($tableSql)) {
$countSql = $this->query("SELECT COUNT(*) AS 'RowCount' FROM '" . $tableRow[0] . "'");
$rowCount = (int)($this->result($countSql, 0, "RowCount"));
$output .= '{"name":"' . $tableRow[0] . '","rowcount":' . $rowCount . '},';
}
if (substr($output, -1) == ",")
$output = substr($output, 0, -1);
$output .= ']';
}
$output .= '}';
}
}
return $output;
}
function error() {
return $this->errorMessage;
}
}