HRDIODB
[ class tree: HRDIODB ] [ index: HRDIODB ] [ all elements ]
Prev Next
Reusing the uars_day Class

Reusing the uars_day Class

A HRDIODB uars_day class instance can read and write information related to a single UARS day. This tutorial will show you how to use the HRDIODB uars_day class in your project to interact with the HRDI database.

Written by Ziba R. Scott and Adam D. Gorski

Table of Contents

Required classes

The uars_day class depends upon the hrdi_db class which requires and is a child class of the mcpear class. Your project must have access to each of these three classes by including the following files:

Optionally, you may be interested in including the debugging debugging.php file for convenience functions.


Create the class instances

The uars_day class is related to the hrdi_db class by composition and requires it as an argument to the constructor. The hrdi_db class requires a DSN as an argument to its constructor. A DSN is the "Data Source Name" which is of the format: phptype(dbsyntax)://username:password@protocol+hostspec/database or more simply: phptype://username:password@hostspec. You can either write your own DSN variable, copy the variable from conf.php or include conf.php. Including conf.php will put all the variables from conf.php into your global name space. The uars_day class constructor also requires an integer representing the UARS Day that the instance will represent.

  1. /* HRDI configuration file */
  2. require_once("conf.php");
  3. /* HRDI specific database interface */
  4. require_once("hrdi_db_class.php");
  5. /* HRDI specific search methods */
  6. require_once("uars_day_class.php");
  7.  
  8. $MyUarsDay 71;
  9.  
  10. $hdb new hrdi_db($dsn);
  11. $day new uars_day($hdb$MyUarsDay);

Reading UARS Day Information

Once the class instance has been made (with a valid UARS Day), it is populated with data automatically. See the uars_day class documentation for a complete list of the contents of the instance.

  1. // Example usage of a $day object instance
  2. print_r($day->data);
  3. print_r($day->modes);

Editing UARS Day Information

Once a day instance has been created the values in the associative array $day->data can be edited and saved to the database. Only existing values will be saved. Day creation is the responsibility of the CSV interface.

  1. $new_data $day->data;
  2. $new_data["Beta_Angle"40;
  3. $day->save($new_data)

Prev   Next
MySQL Backups Writing New Predefined Searches

Documentation generated on Tue, 23 Jan 2007 22:57:41 -0500 by phpDocumentor 1.3.0RC6