mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
commit
d715515f94
23
binding.gyp
23
binding.gyp
@ -5,8 +5,27 @@
|
||||
'sources': [
|
||||
'src/binding.cc'
|
||||
],
|
||||
'include_dirs': ['<!@(pg_config --includedir)'],
|
||||
'libraries' : ['-lpq -L<!@(pg_config --libdir)']
|
||||
'conditions' : [
|
||||
['OS=="mac"', {
|
||||
'include_dirs': ['<!@(pg_config --includedir)'],
|
||||
'libraries' : ['-lpq -L<!@(pg_config --libdir)']
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
'include_dirs': ['<!@(pg_config --includedir)'],
|
||||
'libraries' : ['-lpq -L<!@(pg_config --libdir)']
|
||||
}],
|
||||
['OS=="win"', {
|
||||
'include_dirs': ['<!@(pg_config --includedir)'],
|
||||
'libraries' : ['libpq.lib'],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool' : {
|
||||
'AdditionalLibraryDirectories' : [
|
||||
'<!@(pg_config --libdir)\\'
|
||||
]
|
||||
},
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -78,11 +78,18 @@ public:
|
||||
TRACE("created class");
|
||||
}
|
||||
|
||||
//static function called by libev as callback entrypoint
|
||||
//static function called by libuv as callback entrypoint
|
||||
static void
|
||||
io_event(uv_poll_t* w, int status, int revents)
|
||||
{
|
||||
|
||||
TRACE("Received IO event");
|
||||
|
||||
if(status == -1) {
|
||||
LOG("Connection error.");
|
||||
return;
|
||||
}
|
||||
|
||||
Connection *connection = static_cast<Connection*>(w->data);
|
||||
connection->HandleIOEvent(revents);
|
||||
}
|
||||
@ -294,7 +301,7 @@ protected:
|
||||
return rv;
|
||||
}
|
||||
|
||||
int Cancel()
|
||||
bool Cancel()
|
||||
{
|
||||
PGcancel* pgCancel = PQgetCancel(connection_);
|
||||
char errbuf[256];
|
||||
@ -379,13 +386,9 @@ protected:
|
||||
Emit("notice", ¬ice);
|
||||
}
|
||||
|
||||
//called to process io_events from libev
|
||||
//called to process io_events from libuv
|
||||
void HandleIOEvent(int revents)
|
||||
{
|
||||
if(revents & EV_ERROR) {
|
||||
LOG("Connection error.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(connecting_) {
|
||||
TRACE("Processing connecting_ io");
|
||||
@ -393,8 +396,8 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
if(revents & EV_READ) {
|
||||
TRACE("revents & EV_READ");
|
||||
if(revents & UV_READABLE) {
|
||||
TRACE("revents & UV_READABLE");
|
||||
if(PQconsumeInput(connection_) == 0) {
|
||||
End();
|
||||
EmitLastError();
|
||||
@ -402,7 +405,7 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
//declare handlescope as this method is entered via a libev callback
|
||||
//declare handlescope as this method is entered via a libuv callback
|
||||
//and not part of the public v8 interface
|
||||
HandleScope scope;
|
||||
|
||||
@ -432,8 +435,8 @@ protected:
|
||||
|
||||
}
|
||||
|
||||
if(revents & EV_WRITE) {
|
||||
TRACE("revents & EV_WRITE");
|
||||
if(revents & UV_WRITABLE) {
|
||||
TRACE("revents & UV_WRITABLE");
|
||||
if (PQflush(connection_) == 0) {
|
||||
StopWrite();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user