Permalink
Browse files

Removing default port and throwing exception if Query.execute() is ca…

…lled without an active connection
  • Loading branch information...
1 parent c8f2a0a commit 76c4180fd9ba56ecde583a51629ed4a0231e720b @mariano committed Jun 17, 2011
Showing with 4 additions and 1 deletion.
  1. +0 −1 connection.cc
  2. +4 −0 query.cc
View
@@ -3,7 +3,6 @@
node_db::Connection::Connection()
:quoteString('\''),
- port(3306),
alive(false),
quoteName('`') {
pthread_mutex_init(&(this->connectionLock), NULL);
View
@@ -593,6 +593,10 @@ v8::Handle<v8::Value> node_db::Query::Execute(const v8::Arguments& args) {
node_db::Query *query = node::ObjectWrap::Unwrap<node_db::Query>(args.This());
assert(query);
+ if (!query->connection->isAlive(false)) {
+ THROW_EXCEPTION("Can't execute a query without being connected")
+ }
+
if (args.Length() > 0) {
v8::Handle<v8::Value> set = query->set(args);
if (!set.IsEmpty()) {

0 comments on commit 76c4180

Please sign in to comment.