64 Commits

Author SHA1 Message Date
brianc
683d636501 better handling of client stream termination
1. Pass an error to an active query if the client is ended while a query is in progress.
2. actually emit 'end' event on the client when the stream ends
3. do not emit an error from native bindings if lasterror is null
2013-03-28 13:24:33 -05:00
brianc
2273f5796f fix native on node v0.9.x - closes #297 2013-03-07 08:17:41 -06:00
Philipp Borgers
320a049b2b add a NODE_MODULE() statement; fixes #222 2013-01-24 12:09:38 +01:00
bmc
020607c49c return false as default/fall-through value 2013-01-22 23:17:10 -06:00
bmc
6da25609cf fix native compile warnings 2013-01-21 15:44:34 -06:00
anton
88d684f925 bugfix. sometimes native copy to loose rows 2013-01-20 19:45:41 -06:00
anton
c5c31143c1 1. behave correctly if copy to/from is send to db by query method (report error in standart way); 2. bugfix and code review in native copy to implementation 2013-01-20 19:45:40 -06:00
anton
8bcd40595d make copy related events to have same names in native and libpq clients 2013-01-06 12:06:26 -06:00
anton
5cb871c143 minimal error handling 2013-01-06 12:06:26 -06:00
anton
c014096e0e COPY TO/FROM native/libpq done. Looks like it works, but need to test 2013-01-06 12:06:26 -06:00
brianc
99f1717ba8 make error message text more obvious 2012-12-10 23:23:23 -06:00
booo
7826e492b4 Change return type of Cancel() to bool.
This should fix the following warning on windows:

..\src\binding.cc(117): warning C4800: 'int' : forcing value to bool 'true' or
'false' (performance warning)

Spotted in issue #165.
2012-09-26 22:00:24 +02:00
booo
175d18dce7 Fix for issue #165. Use libuv events instead of libev events. 2012-09-26 22:00:24 +02:00
Ben Montgomery
52b1361f67 remove unnecessary whitespace 2012-08-07 08:38:57 -05:00
Ben Montgomery
a9635a3d8d Improve error message accuracy of native SendQuery
* add private method const char *GetLastError() to src/binding.cc
* add var const char *lastErrorMessage to SendQuery in src/binding.cc
* throw result of PQErrorMessage inside SendQuery

This commit replaces the static/vague error message "PQsendQuery
returned error code" with the actual message text of the error.
The method GetLastError() returns the text of PQErrorMessage.
GetLastError is called from within SendQuery to retrieve the message.
2012-08-07 08:38:57 -05:00
booo
5329e5e17e check if the uv_poll_t struct is initialized before calling uv_poll_stop
Before this fix a call to End after an error in Connect() would result in
a segfault.

https://github.com/brianc/node-postgres/issues/136#issuecomment-6774321
2012-07-06 15:16:04 +02:00
booo
3680b5931b remove unnecessary LOG call; we emit a proper error later in the code 2012-07-06 14:25:07 +02:00
booo
60130a933d check for CONNECTION_BAD status before calling PQsetnonblocking 2012-07-06 14:22:59 +02:00
booo
125075b796 call uv_poll_start on Flush() 2012-07-06 14:15:51 +02:00
booo
d7b9f64b02 remove unnecessary comments 2012-07-06 14:08:03 +02:00
booo
70de032e61 initial fix for issue #136
Test case from ticket works but some tests fail.

Signed-off-by: brianc <brian.m.carlson@gmail.com>
2012-07-05 22:38:07 -05:00
brianc
176e6c7ab2 include command metadata with native query result callback - closes #128 2012-05-30 23:38:03 -05:00
Phil Sorber
0b34675449 Flush writes to server after every send. 2012-03-12 21:34:35 -04:00
wink
e0313aeffd if PQconsumeInput returns 0, something broke, throw an error! 2012-03-01 15:13:47 -06:00
Christophe Macabiau
fe6d5aeb68 query cancellation (libpq native binding) 2011-11-02 19:30:44 +01:00
brianc
558cbbb66a fix compiler warning 2011-10-12 10:52:20 -05:00
brianc
b59e0041b3 native bindings compatible with v0.5.x 2011-10-10 22:03:27 -05:00
Homme Zwaagstra
21b597ef17 All errors are now instances of the built in Error class
This is a fix for issue #50. It alters both the native binding and the
javascript binding to ensure that any errors returned by Postgresql
are returned to the client code as instances of the built in Error
class.

The test code has been updated to assert that this is the case. Rather
than run some individual tests the updated test code ensures this is
the case for *all* errors encountered during a test run.
2011-09-22 12:36:12 +01:00
brianc
0ea77f475b fix for gh-issue #26 2011-05-19 20:46:27 -05:00
Brian Carlson
e4ce36bda8 support for 'payload' of notification in postgres >=9.0 2011-04-14 22:53:44 -05:00
Brian Carlson
863a1ba85c inline AbortConnection 2011-04-14 22:42:35 -05:00
Brian Carlson
af8ebe520c AbortError should return void 2011-04-14 22:41:00 -05:00
Brian Carlson
2836c8b64d native connection failures gracefully emit error from libpq 2011-04-14 22:38:55 -05:00
brianc
a2f7ca3939 code cleanup 2011-03-08 20:14:50 -06:00
brianc
cabca209c7 named queries working & all tests passing 2011-03-06 22:27:35 -06:00
brianc
1fd718bd74 work on named prepared statements 2011-03-06 21:32:58 -06:00
brianc
941b2e298d work on named queries 2011-03-05 12:01:57 -06:00
brianc
0d7822d1cd use symbols in row value object property names 2011-03-05 11:35:37 -06:00
brianc
3399352383 errors from libpq come back with appropriate data 2011-03-04 22:28:40 +00:00
brianc
c1b5fe2ab0 native 'notify' and 'notification' events 2011-03-04 20:04:59 +00:00
brianc
2b24703e17 notification bindings a bit more solid 2011-03-03 23:26:09 -06:00
brianc
16aa5ae981 working on bubbling up notifications 2011-03-03 22:55:06 -06:00
brianc
e8dec61677 ignore PGRES_EMPTY_QUERY message 2011-03-03 22:37:19 -06:00
brianc
cbd14d0f73 removed 'isbusy' log message 2011-03-03 20:50:35 -06:00
brianc
08eddd26e2 make type coercion a part of the api 2011-03-03 18:05:29 +00:00
bmc
b76ced7144 begin type coercion for libpq 2011-03-01 21:03:51 +00:00
bmc
8c7083207a string based parameterized statements working 2011-03-01 01:49:02 +00:00
brianc
23717bf8be some bound exec work 2011-02-25 00:33:20 -06:00
brianc
567446e090 error tests 2011-02-24 22:06:19 -06:00
brianc
b7c3db5f32 error test 2011-02-24 21:50:17 -06:00