Beispiel #1
0
 /**
  * Get a table object.
  *
  * @param string $tablename
  * @return Webdb_DBMS_Database
  */
 public function get_table($tablename = FALSE)
 {
     if (!$tablename) {
         $tablename = Request::current()->param('tablename', FALSE);
         if ($tablename) {
             return $this->get_table($tablename);
         } else {
             return FALSE;
         }
     }
     if (!in_array($tablename, $this->list_tables())) {
         throw new Exception("The table '{$tablename}' could not be found.");
     }
     if (!isset($this->_tables[$tablename])) {
         $table = new Webdb_DBMS_Table($this, $tablename);
         if ($table->can('select')) {
             $this->_tables[$tablename] = $table;
         } else {
             return FALSE;
         }
     }
     return $this->_tables[$tablename];
 }