Permalink
Browse files

Split bindings header file into separate headers for MysqlSyncConn/My…

…sqlSyncRes/MysqlSyncStmt
  • Loading branch information...
1 parent 14ea020 commit d78554f30808298fc9d863ddca9db7deaeda0374 @Sannis committed Mar 30, 2010
View
@@ -1,4 +1,4 @@
*~
build/
.lock-wscript
-mysql_sync_bindings.node
+mysql_bindings.node
View
@@ -4,7 +4,7 @@ Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
-var binding = require("./mysql_sync_bindings");
+var binding = require("./mysql_bindings");
var MysqlSyncConn = binding.MysqlSyncConn;
var sys = require("sys");
@@ -4,7 +4,9 @@ Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
-#include "./mysql_sync_bindings.h"
+#include "./mysql_bindings_connection.h"
+#include "./mysql_bindings_result.h"
+#include "./mysql_bindings_statement.h"
// Only for fixing some cpplint.py errors:
// Lines should be <= 80 characters long
@@ -4,8 +4,8 @@ Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
-#ifndef NODE_MYSQL_BINDINGS_H
-#define NODE_MYSQL_BINDINGS_H
+#ifndef NODE_MYSQL_CONNECTION_H
+#define NODE_MYSQL_CONNECTION_H
#include <mysql/mysql.h>
@@ -18,7 +18,6 @@ See license text in LICENSE file
// [build/namespaces] [5] error in cpplint.py
using namespace v8;
-// For MysqlSyncConn
// static Persistent<String> affectedRows_symbol;
// static Persistent<String> autoCommit_symbol;
// static Persistent<String> changeUser_symbol;
@@ -59,12 +58,6 @@ using namespace v8;
// static Persistent<String> useResult_symbol;
// static Persistent<String> warningCount_symbol;
-// For MysqlSyncRes
-// static Persistent<String> fetchResult_symbol;
-
-// For MysqlSyncStmt
-// static Persistent<String> prepare_symbol;
-
class MysqlSyncConn : public node::EventEmitter {
public:
struct MysqlSyncConnInfo {
@@ -75,6 +68,10 @@ class MysqlSyncConn : public node::EventEmitter {
const char *host_info;
uint32_t proto_info;
};
+
+ class MysqlSyncRes;
+
+ class MysqlSyncStmt;
static void Init(Handle<Object> target);
@@ -180,54 +177,12 @@ class MysqlSyncConn : public node::EventEmitter {
static Handle<Value> UseResult(const Arguments& args);
static Handle<Value> WarningCount(const Arguments& args);
-
- class MysqlSyncRes : public EventEmitter {
- public:
- static Persistent<FunctionTemplate> constructor_template;
-
- static void Init(Handle<Object> target);
-
- protected:
- MYSQL_RES *_res;
-
- MysqlSyncRes();
-
- explicit MysqlSyncRes(MYSQL_RES *my_result):
- _res(my_result), EventEmitter() {}
-
- ~MysqlSyncRes();
-
- static Handle<Value> New(const Arguments& args);
-
- static Handle<Value> FetchResult(const Arguments& args);
- };
-
- class MysqlSyncStmt : public EventEmitter {
- public:
- static Persistent<FunctionTemplate> constructor_template;
-
- static void Init(Handle<Object> target);
-
- protected:
- MYSQL_STMT *_stmt;
-
- MysqlSyncStmt();
-
- explicit MysqlSyncStmt(MYSQL_STMT *my_stmt):
- _stmt(my_stmt), EventEmitter() {}
-
- ~MysqlSyncStmt();
-
- static Handle<Value> New(const Arguments& args);
-
- static Handle<Value> Prepare(const Arguments& args);
- };
};
-Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncRes::constructor_template;
-Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncStmt::constructor_template;
+//Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncRes::constructor_template;
+//Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncStmt::constructor_template;
extern "C" void init(Handle<Object> target);
-#endif // NODE_MYSQL_BINDINGS_H
+#endif // NODE_MYSQL_CONNECTION_H
View
@@ -0,0 +1,47 @@
+/*
+Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
+
+See license text in LICENSE file
+*/
+
+#ifndef NODE_MYSQL_RESULT_H
+#define NODE_MYSQL_RESULT_H
+
+#include <mysql/mysql.h>
+
+#include <v8.h>
+#include <node.h>
+#include <node_events.h>
+
+// This line caused
+// "Do not use namespace using-directives. Use using-declarations instead."
+// [build/namespaces] [5] error in cpplint.py
+using namespace v8;
+
+// static Persistent<String> fetchResult_symbol;
+
+class MysqlSyncConn::MysqlSyncRes : public EventEmitter {
+ public:
+ static Persistent<FunctionTemplate> constructor_template;
+
+ static void Init(Handle<Object> target);
+
+ protected:
+ MYSQL_RES *_res;
+
+ MysqlSyncRes();
+
+ explicit MysqlSyncRes(MYSQL_RES *my_result):
+ _res(my_result), EventEmitter() {}
+
+ ~MysqlSyncRes();
+
+ static Handle<Value> New(const Arguments& args);
+
+ static Handle<Value> FetchResult(const Arguments& args);
+};
+
+Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncRes::constructor_template;
+
+#endif // NODE_MYSQL_RESULT_H
+
View
@@ -0,0 +1,47 @@
+/*
+Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
+
+See license text in LICENSE file
+*/
+
+#ifndef NODE_MYSQL_STATEMENT_H
+#define NODE_MYSQL_STATEMENT_H
+
+#include <mysql/mysql.h>
+
+#include <v8.h>
+#include <node.h>
+#include <node_events.h>
+
+// This line caused
+// "Do not use namespace using-directives. Use using-declarations instead."
+// [build/namespaces] [5] error in cpplint.py
+using namespace v8;
+
+// static Persistent<String> prepare_symbol;
+
+class MysqlSyncConn::MysqlSyncStmt : public EventEmitter {
+ public:
+ static Persistent<FunctionTemplate> constructor_template;
+
+ static void Init(Handle<Object> target);
+
+ protected:
+ MYSQL_STMT *_stmt;
+
+ MysqlSyncStmt();
+
+ explicit MysqlSyncStmt(MYSQL_STMT *my_stmt):
+ _stmt(my_stmt), EventEmitter() {}
+
+ ~MysqlSyncStmt();
+
+ static Handle<Value> New(const Arguments& args);
+
+ static Handle<Value> Prepare(const Arguments& args);
+};
+
+Persistent<FunctionTemplate> MysqlSyncConn::MysqlSyncStmt::constructor_template;
+
+#endif // NODE_MYSQL_STATEMENT_H
+
View
10 wscript
@@ -18,8 +18,8 @@ def configure(conf):
def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
- obj.target = "mysql_sync_bindings"
- obj.source = "mysql_sync_bindings.cc"
+ obj.target = "mysql_bindings"
+ obj.source = "mysql_bindings_connection.cc"
# This doesn't working in my OpenSUSE 11.1 because *.pc file for MySQL doesn't exists
#obj.uselib = "MYSQL"
obj.lib = "mysqlclient"
@@ -28,8 +28,8 @@ def test(tst):
Utils.exec_command('./tests/run-tests.sh')
def lint(lnt):
- Utils.exec_command('cpplint ./mysql_sync_bindings.cc')
- Utils.exec_command('cpplint ./mysql_sync_bindings.h')
+ Utils.exec_command('cpplint ./mysql_conn_bindings.cc')
+ Utils.exec_command('cpplint ./mysql_conn_bindings.h')
Utils.exec_command('nodelint ./mysql-sync.js')
Utils.exec_command('nodelint ./tests/settings.js')
Utils.exec_command('nodelint ./tests/test-*.js')
@@ -39,7 +39,7 @@ def lint(lnt):
def shutdown():
# HACK to get bindings.node out of build directory.
# better way to do this?
- t = 'mysql_sync_bindings.node'
+ t = 'mysql_bindings.node'
if Options.commands['clean']:
if exists(t): unlink(t)
else:

0 comments on commit d78554f

Please sign in to comment.