changes in database

- rename "funktion" to "function"
- change structure/type of some fields (performance)
This commit is contained in:
JHCD 2015-07-13 14:15:33 +02:00
parent d8981ba114
commit ffb1495a3b
2 changed files with 17 additions and 17 deletions

View file

@ -84,13 +84,13 @@ def run(typ,freq,data):
logging.debug("Insert %s", typ)
if typ == "FMS":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time,fms,status,direction,directionText,tsi,description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)",(data["fms"],data["status"],data["direction"],data["directionText"],data["tsi"],data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time, fms, status, direction, directionText, tsi, description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)", (data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"]))
elif typ == "ZVEI":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time,zvei,description) VALUES (NOW(),%s,%s)",(data["zvei"],data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (NOW(),%s,%s)", (data["zvei"], data["description"]))
elif typ == "POC":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time,ric,funktion,funktionChar,msg,bitrate,description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)",(data["ric"],data["function"],data["functionChar"],data["msg"],data["bitrate"],data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)", (data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"]))
else:
logging.warning("Invalid Typ: %s", typ)

View file

@ -32,12 +32,12 @@ SET time_zone = "+00:00";
CREATE TABLE IF NOT EXISTS `bos_fms` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`fms` varchar(8) NOT NULL,
`status` varchar(1) NOT NULL,
`direction` varchar(1) NOT NULL,
`directionText` text(10) NOT NULL,
`fms` char(8) NOT NULL,
`status` char(1) NOT NULL,
`direction` char(1) NOT NULL,
`directionText` char(10) NOT NULL,
`tsi` varchar(3) NOT NULL,
`description` text NOT NULL,
`description` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@ -50,12 +50,12 @@ CREATE TABLE IF NOT EXISTS `bos_fms` (
CREATE TABLE IF NOT EXISTS `bos_pocsag` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`ric` varchar(7) NOT NULL DEFAULT '0',
`funktion` int(1) NOT NULL,
`funktionChar` text(1) NOT NULL,
`msg` text NOT NULL,
`bitrate` int(4) NOT NULL,
`description` text NOT NULL,
`ric` char(7) NOT NULL,
`function` int(1) NOT NULL,
`functionChar` char(1),
`bitrate` int(4),
`msg` text,
`description` text,
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@ -68,11 +68,11 @@ CREATE TABLE IF NOT EXISTS `bos_pocsag` (
CREATE TABLE IF NOT EXISTS `bos_zvei` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`zvei` varchar(5) NOT NULL DEFAULT '0',
`description` text NOT NULL,
`zvei` char(5) NOT NULL,
`description` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;