Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated README and a couple tweaks to common.h

  • Loading branch information...
commit 75b9475b251cbbd1e29c6e8ae7ac7eba7043dbbe 1 parent 5221801
Todd Treece authored
Showing with 14 additions and 14 deletions.
  1. +13 −11 README.md
  2. +1 −3 common.h
24 README.md
View
@@ -1,6 +1,6 @@
# lib_mysqludf_mongodb
-The goal of the project is to allow MySQL triggers to store data in MongoDB. By tracking MySQL inserts/updates/deletes will not cause the MySQL database to grow, which will make backing up system critical data faster and easier.
+The goal of the project is to allow MySQL triggers to store data in MongoDB. By tracking MySQL changes (inserts/updates/deletes) in MongoDB, backing up system critical data will become faster and easier.
## Requirements
* [MongoDB C Driver](http://www.mongodb.org/display/DOCS/C+Language+Center)
@@ -57,19 +57,21 @@ The goal of the project is to allow MySQL triggers to store data in MongoDB. By
DROP TRIGGER IF EXISTS mongodb_update_trigger $$
- CREATE TRIGGER mongo_update_trigger BEFORE UPDATE ON users
+ CREATE TRIGGER mongodb_update_trigger BEFORE UPDATE ON users
FOR EACH ROW BEGIN
- SELECT mongodb_save(
- 'test.customers.history' AS 'collection',
- NEW.id AS 'users_id',
- NEW.username AS 'username'
- NEW.firstname AS 'firstname',
- NEW.lastname AS 'lastname',
- NEW.email AS 'email',
- 'update' AS 'history_type',
- NOW() AS 'timestamp'
+ SET @save = (
+ SELECT mongodb_save(
+ 'test.users.history' AS 'collection',
+ NEW.id AS 'users_id',
+ NEW.username AS 'username',
+ NEW.firstname AS 'firstname',
+ NEW.lastname AS 'lastname',
+ NEW.email AS 'email',
+ 'update' AS 'history_type',
+ NOW() AS 'timestamp'
+ )
);
END;
4 common.h
View
@@ -1,6 +1,5 @@
#ifndef MYSQLUDF_COMMON_H
#define MYSQLUDF_COMMON_H
-#define DLLEXP
#include <string.h>
#include <stdlib.h>
@@ -13,8 +12,6 @@ typedef unsigned long long ulonglong;
typedef long long longlong;
#include <mysql.h>
-//#include <m_ctype.h>
-//#include <m_string.h>
#include "mongo.h"
#include "utf8.h"
@@ -24,4 +21,5 @@ typedef long long longlong;
#define ERRMSG_SIZE 1000
extern mongo mongodb_connection[1];
+
#endif /* MYSQLUDF_COMMON_H */
Please sign in to comment.
Something went wrong with that request. Please try again.