Technology Serving Sustainability

Sep 06, 2010 - 08:40 AM
Homepage :: Downloads :: WebLinks :: FAQ 
Search   
Login
 Username
 Password
 Remember me


 Log in Problems?
 New User? Sign Up!

Online
We have 9 guests and 0 members online

Welcome Guest, become a member today.


Main
· Home
· What is it?
· Some Examples
· About CWC
· Contact Us
· Brochure (PDF)

Technical
· Data Download
· Manual (pdf)

Admin


Extracting Database Content
Last Updated : 2005-03-24 15:00:04 (5296 read)
[Printer friendly page | Send to a friend]

Extracting Data from the Database

Data is stored in tables in a MySQL database. We provide a function that will allow you to extract data from these tables.

To do this, use the get_db_data.php page. The URL to access this data will be of the form

http://chuck-wright.com/wcsd/get_db_data.php?<parms>

where parms are

  • pwd=(password) - is the password for data access to this table. (not implemented yet)
  • deviceid=(deviceid) - is the unique ID of the device whose data is being sought.
  • interval[]=(interval) - gives the starting and ending times of the time interval being plotted (Unix time). The first insertion is the starting time and the second is the ending time. If not present, and month/day/year are not present, then a default interval of the last 24 hours is used.
  • month=(month) - month of the starting time - 1-12
  • day=(day) - day of the starting time - 1-31
  • year=(year) - year of the starting time - 4 digits
  • duration=(duration) - duration of the interval, in days - If month/day/year are used, then interval will be ignored.
  • timespec=(timespec) - used in place of interval or m/d/y, one of the following:
    • today
    • yesterday
    • lasthour
    • lastNhours - where N is a single digit
    • lastday
    • lastNdays - where N is a single digit
    • lastNmonths
    • lastNyears
    • mtd or MTD
    • ytd or YTD
    • prevmonth - the previous month
    • lastmonth - the last 31 days
  • nocal=true - Ordinarily, raw data will be calibrated according to the scale and offset values stored in the database. If this parm is included, raw data only will be sent.
  • (more as it evolves)

Examples:

Get data for a device for the last 24 hours.
http://chuck-wright.com/wcsd/get_db_data.php?deviceid=390000000519611D_0&timespec=lastday

The first line contains a single string indicating the type of data. Data is returned in text format, with each line containing a time followed by a value. The time is in "Unix" time, that is, the number of seconds since midnight on 1/1/70.

The result in its raw form can be viewed using a browser to access the data, and then using "view source". From here it can be "cut and pasted".

More commonly, a script of some sort will be written to automatically access the data and process it.

To request other formats, please contact WCS.

PostNuke :: PostNuke Support :: Developers 

Web site powered by PostNuke ADODB database libraryPHP Language

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2003 by me
This web site was made with PostNuke, a web portal system written in PHP. PostNuke is Free Software released under the GNU/GPL license.
You can syndicate our news using the file backend.php