-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatabase.sql
More file actions
55 lines (45 loc) · 1.17 KB
/
database.sql
File metadata and controls
55 lines (45 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 02, 2013 at 02:39 PM
-- Server version: 5.5.28
-- PHP Version: 5.4.4-12
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- User: `PowerMeter`
--
GRANT USAGE ON *.* TO 'PowerMeter'@'localhost' IDENTIFIED BY PASSWORD {password};
GRANT EXECUTE ON `PowerMeter`.* TO 'PowerMeter'@'localhost';
--
-- Database: `PowerMeter`
--
CREATE DATABASE `PowerMeter` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `PowerMeter`;
DELIMITER $$
--
-- Procedures
--
CREATE PROCEDURE `StoreMeterReading`(
IN recordedAt DATETIME,
IN temperature DECIMAL(5,1),
IN watts INT
)
BEGIN
INSERT INTO LiveData
(TakenAt, Temperature, MeterReading)
VALUES (recordedAt, temperature, watts);
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `LiveData`
--
CREATE TABLE IF NOT EXISTS `LiveData` (
`TakenAt` datetime NOT NULL,
`Temperature` decimal(5,1) NOT NULL,
`MeterReading` int(10) unsigned NOT NULL,
PRIMARY KEY (`TakenAt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;