[456] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r585 - in trunk/owl: . doc

daemon@ATHENA.MIT.EDU (chmrr@MIT.EDU)
Thu Oct 29 18:06:22 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: chmrr@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Date: Tue, 06 Feb 2007 16:40:42 -0500

Author: chmrr
Date: 2007-02-06 16:40:41 -0500 (Tue, 06 Feb 2007)
New Revision: 585

Added:
   trunk/owl/doc/owlconf-dbi
   trunk/owl/doc/zephyr_log.sql
Modified:
   trunk/owl/
Log:
 r1380@utwig:  chmrr | 2007-02-06 16:40:38 -0500
  * Database bits



Property changes on: trunk/owl
___________________________________________________________________
Name: svk:merge
   - 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1373
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
   + 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1380
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641

Added: trunk/owl/doc/owlconf-dbi
===================================================================
--- trunk/owl/doc/owlconf-dbi	                        (rev 0)
+++ trunk/owl/doc/owlconf-dbi	2007-02-06 21:40:41 UTC (rev 585)
@@ -0,0 +1,31 @@
+sub owl::startup {
+  use DBI;
+  use DateTime;
+  use DateTime::Format::Strptime;
+  $owl::strp = DateTime::Format::Strptime->new(pattern => "%a %b %d %T %Y");
+}
+
+
+sub owl::db_connect {
+  return if $owl::dbh and $owl::dbh->ping;
+  $owl::dbh = DBI->connect("DBI:mysql:database=zephyr_log",
+                           "owl", "", {RaiseError => 1});
+  $owl::sth = $owl::dbh->prepare("INSERT INTO messages(sender, class, instance, opcode, sent, received, host, zsig, body) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
+}
+
+sub owl::receive_msg {
+  my $msg = shift;
+  return unless $msg->is_zephyr and not $msg->is_personal;
+  my $sent = $owl::strp->parse_datetime($msg->time);
+  owl::db_connect();
+  $owl::sth->execute($msg->sender,
+                     $msg->class,
+                     $msg->instance,
+                     $msg->opcode ? $msg->opcode : undef,
+                     $sent->datetime,
+                     DateTime->now->datetime,
+                     lc $msg->hostname,
+                     $msg->zsig,
+                     $msg->body,
+                    );
+}

Added: trunk/owl/doc/zephyr_log.sql
===================================================================
--- trunk/owl/doc/zephyr_log.sql	                        (rev 0)
+++ trunk/owl/doc/zephyr_log.sql	2007-02-06 21:40:41 UTC (rev 585)
@@ -0,0 +1,55 @@
+-- MySQL dump 10.10
+--
+-- Host: localhost    Database: zephyr_log
+-- ------------------------------------------------------
+-- Server version	5.0.26-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `messages`
+--
+
+DROP TABLE IF EXISTS `messages`;
+CREATE TABLE `messages` (
+  `id` int(11) NOT NULL auto_increment,
+  `sender` varchar(100) NOT NULL default '',
+  `class` varchar(100) NOT NULL default '',
+  `instance` varchar(100) NOT NULL default '',
+  `opcode` varchar(100) default NULL,
+  `sent` timestamp NOT NULL default CURRENT_TIMESTAMP,
+  `received` timestamp NULL default NULL,
+  `host` varchar(200) NOT NULL default '',
+  `zsig` text NOT NULL,
+  `body` text,
+  PRIMARY KEY  (`id`),
+  KEY `index_class` (`class`),
+  KEY `index_instance` (`instance`),
+  KEY `index_class_instance` (`class`,`instance`),
+  KEY `index_class_instance_sender` (`class`,`instance`,`sender`),
+  KEY `index_class_sender` (`class`,`sender`),
+  KEY `index_sender` (`sender`),
+  KEY `index_host` (`host`),
+  KEY `index_sent` (`sent`),
+  FULLTEXT KEY `index_body` (`body`)
+) ENGINE=MyISAM AUTO_INCREMENT=1517065 DEFAULT CHARSET=utf8;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!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 */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2007-02-06 21:39:09


home help back first fref pref prev next nref lref last post