List tables in database
public list_tables ( $table = "glpi_%" ) : list | ||
$table | table name condition (glpi_% as default to retrieve only glpi tables) | |
Результат | list | of tables |
/** * Verify if a DB table exists * * @param $tablename string : Name of the table we want to verify. * * @return bool : true if exists, false elseway. **/ function OcsTableExists($tablename) { // Get a list of tables contained within the database. $result = $this->db->list_tables("%" . $tablename . "%"); if ($rcount = $this->db->numrows($result)) { while ($data = $this->db->fetch_row($result)) { if ($data[0] === $tablename) { return true; } } } $this->db->free_result($result); return false; }