Commit 41183e55 by Konstantin Käfer

make compatible with g++

parent 57bcffb3
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
return constructor_template->HasInstance(obj); return constructor_template->HasInstance(obj);
} }
static struct Baton { struct Baton {
Database* db; Database* db;
Persistent<Function> callback; Persistent<Function> callback;
int status; int status;
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
} }
}; };
static struct OpenBaton : Baton { struct OpenBaton : Baton {
std::string filename; std::string filename;
int mode; int mode;
......
...@@ -158,11 +158,11 @@ const char* sqlite_code_string(int code); ...@@ -158,11 +158,11 @@ const char* sqlite_code_string(int code);
#define DELETE_FIELD(field) \ #define DELETE_FIELD(field) \
switch ((field)->type) { \ switch ((field)->type) { \
case SQLITE_INTEGER: delete (Data::Integer*)(field); break; \ case SQLITE_INTEGER: delete (Values::Integer*)(field); break; \
case SQLITE_FLOAT: delete (Data::Float*)(field); break; \ case SQLITE_FLOAT: delete (Values::Float*)(field); break; \
case SQLITE_TEXT: delete (Data::Text*)(field); break; \ case SQLITE_TEXT: delete (Values::Text*)(field); break; \
case SQLITE_BLOB: delete (Data::Blob*)(field); break; \ case SQLITE_BLOB: delete (Values::Blob*)(field); break; \
case SQLITE_NULL: delete (Data::Null*)(field); break; \ case SQLITE_NULL: delete (Values::Null*)(field); break; \
} }
#endif #endif
......
...@@ -19,7 +19,7 @@ using namespace node; ...@@ -19,7 +19,7 @@ using namespace node;
namespace node_sqlite3 { namespace node_sqlite3 {
namespace Data { namespace Values {
struct Field { struct Field {
inline Field(unsigned short _index, unsigned short _type = SQLITE_NULL) : inline Field(unsigned short _index, unsigned short _type = SQLITE_NULL) :
type(_type), index(_index) {} type(_type), index(_index) {}
...@@ -63,11 +63,11 @@ namespace Data { ...@@ -63,11 +63,11 @@ namespace Data {
}; };
typedef Field Null; typedef Field Null;
typedef std::vector<Field*> Row;
typedef std::vector<Row*> Rows;
typedef Row Parameters;
} }
typedef std::vector<Values::Field*> Row;
typedef std::vector<Row*> Rows;
typedef Row Parameters;
...@@ -78,10 +78,10 @@ public: ...@@ -78,10 +78,10 @@ public:
static void Init(Handle<Object> target); static void Init(Handle<Object> target);
static Handle<Value> New(const Arguments& args); static Handle<Value> New(const Arguments& args);
static struct Baton { struct Baton {
Statement* stmt; Statement* stmt;
Persistent<Function> callback; Persistent<Function> callback;
Data::Parameters parameters; Parameters parameters;
Baton(Statement* stmt_, Handle<Function> cb_) : stmt(stmt_) { Baton(Statement* stmt_, Handle<Function> cb_) : stmt(stmt_) {
stmt->Ref(); stmt->Ref();
...@@ -95,26 +95,26 @@ public: ...@@ -95,26 +95,26 @@ public:
} }
}; };
static struct RowBaton : Baton { struct RowBaton : Baton {
RowBaton(Statement* stmt_, Handle<Function> cb_) : RowBaton(Statement* stmt_, Handle<Function> cb_) :
Baton(stmt_, cb_) {} Baton(stmt_, cb_) {}
Data::Row row; Row row;
}; };
static struct RunBaton : Baton { struct RunBaton : Baton {
RunBaton(Statement* stmt_, Handle<Function> cb_) : RunBaton(Statement* stmt_, Handle<Function> cb_) :
Baton(stmt_, cb_), inserted_id(0), changes(0) {} Baton(stmt_, cb_), inserted_id(0), changes(0) {}
sqlite3_int64 inserted_id; sqlite3_int64 inserted_id;
int changes; int changes;
}; };
static struct RowsBaton : Baton { struct RowsBaton : Baton {
RowsBaton(Statement* stmt_, Handle<Function> cb_) : RowsBaton(Statement* stmt_, Handle<Function> cb_) :
Baton(stmt_, cb_) {} Baton(stmt_, cb_) {}
Data::Rows rows; Rows rows;
}; };
static struct PrepareBaton : Database::Baton { struct PrepareBaton : Database::Baton {
Statement* stmt; Statement* stmt;
std::string sql; std::string sql;
PrepareBaton(Database* db_, Handle<Function> cb_, Statement* stmt_) : PrepareBaton(Database* db_, Handle<Function> cb_, Statement* stmt_) :
...@@ -139,7 +139,7 @@ public: ...@@ -139,7 +139,7 @@ public:
struct Async { struct Async {
ev_async watcher; ev_async watcher;
Statement* stmt; Statement* stmt;
Data::Rows data; Rows data;
pthread_mutex_t mutex; pthread_mutex_t mutex;
Persistent<Function> callback; Persistent<Function> callback;
bool completed; bool completed;
...@@ -194,12 +194,12 @@ protected: ...@@ -194,12 +194,12 @@ protected:
static void Finalize(Baton* baton); static void Finalize(Baton* baton);
void Finalize(); void Finalize();
template <class T> inline Data::Field* BindParameter(const Handle<Value> source, T pos); template <class T> inline Values::Field* BindParameter(const Handle<Value> source, T pos);
template <class T> T* Bind(const Arguments& args, int start = 0); template <class T> T* Bind(const Arguments& args, int start = 0);
bool Bind(const Data::Parameters parameters); bool Bind(const Parameters parameters);
static void GetRow(Data::Row* row, sqlite3_stmt* stmt); static void GetRow(Row* row, sqlite3_stmt* stmt);
static Local<Object> RowToJS(Data::Row* row); static Local<Object> RowToJS(Row* row);
void Schedule(EIO_Callback callback, Baton* baton); void Schedule(EIO_Callback callback, Baton* baton);
void Process(); void Process();
void CleanQueue(); void CleanQueue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment