/** * Used to read data from database * * It reads the data from database * * @param array $meta_information the meta information used to fetch the data from database * key_field => string the table key field * data_type => string the data type. it is used to fetch the database table name * condition => array the condition used to fetch the data from database * * @return array $data an array containing the database table data. each array row corresponds to a table row */ public function Read($meta_information) { /** The condition for fetching the data */ $condition = $meta_information['condition']; /** The comma separated list of fields to fetch */ $fields = $meta_information['fields']; /** The application configuration is fetched */ $configuration = $this->GetConfigurationObject(); /** The parameters for the data object */ $meta_information = array("configuration" => $configuration, "key_field" => $meta_information['key_field'], "data_type" => $meta_information['data_type']); /** The MysqlDataObject is created for the excel object*/ $data_object = new MysqlDataObject($meta_information); /** The parameters used to read the data from database */ $parameters = array("fields" => $fields, "condition" => $condition, "read_all" => true); /** The Mysql data is read from database */ $data_object->Read($parameters); /** The mysql table data */ $data = $data_object->GetData(); return $data; }
/** * Used to get the table row data * * It fetches the table row data for the given row id * * @param int $row_id the table row id * @param string $data_type the data type for the database table */ private function GetRowData($row_id, $data_type) { /** The application configuration is fetched */ $configuration = $this->GetConfigurationObject(); /** The parameters for the data object */ $meta_information = array("configuration" => $configuration, "key_field" => "id", "data_type" => $data_type); /** Mysqldataobject is created */ $data_object = new MysqlDataObject($meta_information); /** The parameters used to read the data from database */ $parameters = array("fields" => "*", "condition" => $row_id, "read_all" => false); /** The table row data is read from database */ $data_object->Read($parameters); /** The table row data is fetched */ $row_data = $data_object->GetData(); return $row_data; }