1 #ifndef __QUERY_H_INCLUDED__
2 #define __QUERY_H_INCLUDED__
6 #include <node_buffer.h>
7 #include <node_version.h>
14 #include "node_defs.h"
15 #include "connection.h"
17 #include "exception.h"
23 static void Init(v8::Handle<v8::Object> target, v8::Persistent<v8::FunctionTemplate> constructorTemplate);
25 v8::Handle<v8::Value>
set(
const v8::Arguments& args);
36 std::vector<std::string>* columns;
37 unsigned long* columnLengths;
40 v8::Persistent<v8::Object> context;
46 std::vector<row_t*>* rows;
49 v8::Persistent<v8::Object> context;
63 std::ostringstream sql;
66 std::vector< v8::Persistent<v8::Value> > values;
70 v8::Persistent<v8::Function>* cbStart;
71 v8::Persistent<v8::Function>* cbExecute;
72 v8::Persistent<v8::Function>* cbFinish;
76 static v8::Handle<v8::Value> Select(
const v8::Arguments& args);
77 static v8::Handle<v8::Value>
Skip(
const v8::Arguments& args);
78 static v8::Handle<v8::Value>
Limit(
const v8::Arguments& args);
79 static v8::Handle<v8::Value>
First(
const v8::Arguments& args);
80 static v8::Handle<v8::Value> From(
const v8::Arguments& args);
81 static v8::Handle<v8::Value> Join(
const v8::Arguments& args);
82 static v8::Handle<v8::Value> Where(
const v8::Arguments& args);
83 static v8::Handle<v8::Value> And(
const v8::Arguments& args);
84 static v8::Handle<v8::Value> Or(
const v8::Arguments& args);
85 static v8::Handle<v8::Value> OrderBy(
const v8::Arguments& args);
86 static v8::Handle<v8::Value> Add(
const v8::Arguments& args);
87 static v8::Handle<v8::Value> Insert(
const v8::Arguments& args);
88 static v8::Handle<v8::Value> Into(
const v8::Arguments& args);
89 static v8::Handle<v8::Value> Values(
const v8::Arguments& args);
90 static v8::Handle<v8::Value> Update(
const v8::Arguments& args);
91 static v8::Handle<v8::Value> Set(
const v8::Arguments& args);
92 static v8::Handle<v8::Value> Delete(
const v8::Arguments& args);
93 static v8::Handle<v8::Value> Sql(
const v8::Arguments& args);
94 static v8::Handle<v8::Value>
Execute(
const v8::Arguments& args);
95 static uv_async_t g_async;
96 static void uvExecute(uv_work_t* uvRequest);
97 static void uvEmitResults(uv_async_t* uvAsync,
int status);
98 static void uvExecuteFinished(uv_work_t* Rquest,
int status);
101 std::string fieldName(v8::Local<v8::Value> value)
const throw(
Exception&);
102 std::string tableName(v8::Local<v8::Value> value,
bool escape =
true)
const throw(
Exception&);
103 v8::Handle<v8::Value> addCondition(const v8::Arguments& args, const
char* separator);
104 v8::Local<v8::Object> row(
Result* result,
row_t* currentRow) const;
105 virtual std::
string parseQuery() const throw(Exception&);
106 virtual std::vector<std::
string::size_type>
placeholders(std::
string* parsed) const throw(Exception&);
109 std::
string value(v8::Local<v8::Value> value,
bool inArray = false,
bool escape = true,
int precision = -1) const throw(Exception&);
112 static
bool gmtDeltaLoaded;
115 std::
string fromDate(const
double timeStamp) const throw(Exception&);
119 #endif // __QUERY_H_INCLUDED__