/** * Get the rows of a foreign table where the title column equals a given * value. * * @param WebDB_DBMS_Table $foreign_table * @param string $value The value to match against the title column. * @return Database_Result */ private function get_fk_rows($foreign_table, $value) { $foreign_table->reset_filters(); $foreign_table->add_filter($foreign_table->get_title_column()->get_name(), '=', $value); return $foreign_table->get_rows(); }
/** * Get a table object. * * @param string $tablename * @return Webdb_DBMS_Table */ 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]; }