nodejs-db-informix  master
nodejs bindings for Informix
 All Classes Functions Pages
query.cxx
1 #include "query.h"
2 
3 v8::Persistent<v8::FunctionTemplate>
4  nodejs_db_informix::Query::constructorTemplate;
5 
6 void nodejs_db_informix::Query::Init(v8::Handle<v8::Object> exports) {
7  v8::HandleScope scope;
8 
9  v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
10 
11  constructorTemplate = v8::Persistent<v8::FunctionTemplate>::New(t);
12  constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
13 
14  nodejs_db::Query::Init(exports, constructorTemplate);
15 
16  exports->Set(v8::String::NewSymbol("Query")
17  , constructorTemplate->GetFunction());
18 }
19 
20 /**
21  * Constructor Template
22  */
23 v8::Handle<v8::Value>
24 nodejs_db_informix::Query::New(const v8::Arguments& args) {
25  v8::HandleScope scope;
26 
28  if (query == NULL) {
29  THROW_EXCEPTION("Can't create query object")
30  }
31 
32  if (args.Length() > 0) {
33  v8::Handle<v8::Value> set = query->set(args);
34  if (!set.IsEmpty()) {
35  return scope.Close(set);
36  }
37  }
38 
39  query->Wrap(args.This());
40 
41  return scope.Close(args.This());
42 }