Permalink
Browse files

first commit with dbutils.

  • Loading branch information...
0 parents commit ccc6e1bd2ffcc7d8799b0004ef1945fbbfc482b5 @ewokcillo committed May 14, 2012
Showing with 70 additions and 0 deletions.
  1. +29 −0 givememykbps/dbutils.c
  2. +17 −0 givememykbps/dbutils.h
  3. +24 −0 givememykbps/givememykbps.c
@@ -0,0 +1,29 @@
+/*
+ * dbutils.c
+ *
+ * Created on: 29/01/2012
+ * Author: ewokcillo
+ */
+
+#include "dbutils.h"
+#include "errno.h"
+#include "stdio.h"
+
+
+mongo_sync_connection * get_connection()
+{
+ mongo_sync_connection *conn;
+
+ conn = mongo_sync_connect ("192.168.0.2", 27017, TRUE);
+ if (!conn)
+ fprintf(stderr, "Error in connect to db %s\n", (char *)strerror(errno));
+
+ return conn;
+}
+
+int get_disconnect(mongo_sync_connection **conn)
+{
+ int status = 0;
+ mongo_sync_disconnect(*conn);
+ return status;
+}
@@ -0,0 +1,17 @@
+/*
+ * dbutils.h
+ *
+ * Created on: 29/01/2012
+ * Author: ewokcillo
+ */
+
+#ifndef DBUTILS_H_
+#define DBUTILS_H_
+
+#include <mongo.h>
+#include <bson.h>
+
+mongo_sync_connection * get_connection();
+int get_disconnect(mongo_sync_connection **);
+
+#endif /* DBUTILS_H_ */
@@ -0,0 +1,24 @@
+/*
+ * givemykbps.c
+ *
+ * Created on: 07/08/2011
+ * Author: root
+ */
+
+#include <netinet/in.h>
+#include <errno.h>
+#include <pthread.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+
+
+
+int main(void)
+{
+
+ int status = 0;
+
+ exit(status);
+}

0 comments on commit ccc6e1b

Please sign in to comment.