Commit Graph

126 Commits

Author SHA1 Message Date
Brian C
f3fc6ff705 Merge pull request #546 from CartoDB/2.11-ensure-connect-callback
Ensure connect callback is invoked on premature socket hangup
2014-04-06 11:18:23 -05:00
Victor Widell
5079c1e0c4 Added missing argument to handleError method call.
Before the change, it would crash with a very unhelpful error message:

	[project path]/node_modules/pg/lib/query.js:92
	    connection.sync();
	               ^
	TypeError: Cannot call method 'sync' of undefined
	    at Query.handleError ([project path]/node_modules/pg/lib/query.js:92:16)
	    at Client.connect ([project path]/node_modules/pg/lib/client.js:178:24)
	    at g (events.js:185:14)
	    at EventEmitter.emit (events.js:85:17)
	    at Socket.<anonymous> ([project path]/node_modules/pg/lib/connection.js:60:10)
	    at Socket.EventEmitter.emit (events.js:85:17)
	    at TCP.onread (net.js:424:51)


After the change, it reports a much more helpful

	error running query [Error: Stream unexpectedly ended during query execution]
2014-03-29 16:45:00 +01:00
Sandro Santilli
64d6883a81 Ensure connect callback is invoked on premature socket hangup
Closes #534
2014-03-18 13:03:15 +01:00
Hannes Hörl
7fd79a41c3 Add support for (fallback_)application_name 2014-01-05 18:08:58 +01:00
Hannes Hörl
95295ad2fb Handle .pgpass in the js client 2013-12-06 00:01:51 +01:00
Brian M. Carlson
99f9492c72 Clean up copy-in internal API 2013-10-22 00:23:43 -05:00
Brian M. Carlson
894c60e605 Accept anything with function 'submit' as a query
This allows for passing in custom objects which conform to the query API
2013-10-21 13:29:17 -05:00
Brian M. Carlson
a72bd5cb3c Semi-colons 2013-10-21 09:39:49 -05:00
Brian M. Carlson
fc397ee7f5 Clean up client->query event delegation 2013-10-21 09:20:21 -05:00
Brian Carlson
1674359b57 Respect SSL setting from connection parameters 2013-09-09 11:50:20 -05:00
rpedela
ffe51c20f2 Add missing semicolons. 2013-07-15 09:13:48 -05:00
rpedela
876018e103 Add support for PQescapeLiteral and PQescapeIdentifier. Also add JS versions of the functions. 2013-07-15 09:13:48 -05:00
bmc
56a5903a02 Make throws in query error callback not break client
If you receive an error while running a query and in user's callback
they throw an exception it can disrupt the internal query queue
and prevent a client from ever cleaning up properly
2013-04-19 09:25:53 -05:00
bmc
9b1c4facc2 Make query callback exceptions not break client
If you throw an exception in a query callback the client will not pulse
its internal query queue and therefor will never process any
more queries or emit its own 'drain' event.

I don't find this to be an issue in production code since I restart
the process on exceptions, but it can break tests and cause things
to 'hang'.  My crude benchmarks show no noticable impact in perf
from the try/catch/rethrow.

:q
2013-04-19 09:09:28 -05:00
Karl Mikkelsen
44e4586e18 var utils declared and not used 2013-04-05 17:46:23 +12:00
bmc
766b4286d5 merge branch v1.0 2013-04-04 11:51:55 -05:00
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
1d6541724e remove deprecation warnings & deprecate lib 2013-03-17 14:51:57 -05:00
brianc
e93a4a5d66 remove pauseDrain/resumeDrain 2013-03-07 16:12:09 -06:00
brianc
213518648b ability to hide deprecation warnings 2013-03-07 10:01:14 -06:00
brianc
6415450634 deprecate pauseDrain/resumeDrain & auto-releasing client pool 2013-03-07 09:47:04 -06:00
brianc
c57eee8661 normalize whitespace, add comments, and do a little house cleaning 2013-03-06 10:26:40 -06:00
brianc
b58ae9e7f7 clean up prototype shorthand
For some reason a few years ago I thought it would be neat to use a shorthand version of prototype to save myself some keystrokes.  That was a cosmetic mistake.  It also breaks ctags.

Also, normalized some whitespace.
2013-03-06 08:48:52 -06:00
Philipp Borgers
a7e9072ab8 fix jshint errors in lib/client.js 2013-01-24 22:05:35 +01:00
Philipp Borgers
4e5e75dbee fix jshint errors for lib/client.js 2013-01-24 22:01:52 +01:00
bmc
1e3107aa55 use ConnectionParameters for js client properties 2013-01-21 16:14:19 -06:00
anton
8ea2f259ed bugfix: correctly create new connection for canceling copy to query 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
c014096e0e COPY TO/FROM native/libpq done. Looks like it works, but need to test 2013-01-06 12:06:26 -06:00
Stephen Sugden
903e9b25ea Attach Query constructors to Client constructors 2012-12-16 00:58:30 -06:00
brianc
1c43930ba1 cleanup & fix failing tests to allow for green merge of pull #228 2012-12-10 22:44:58 -06:00
Troy Kruthoff
e62eb9339b make Query a public api 2012-12-10 21:32:20 -06:00
bmc
9341efe669 allow options to pass to js ssl connection bindings 2012-09-10 21:40:41 -05:00
Bruno Harbulot
158562f3d1 Initial support for SSL/TLS connections. 2012-08-20 21:41:56 -05:00
Brian Bickerton
fc3b34d42f Use 'self.activeQuery' insead of 'this.activeQuery' in the readyForQueue event listener. 2012-05-08 10:07:43 -04:00
Kenny Meyer
a25ef7cae4 Fix indentation 2012-03-22 17:32:56 -03:00
Alexander Sulfrian
f8962fd036 connection can be binary by default
if connection is created with config.binary = true, all queries get
executed with binary result unless explicit disabled with binary = false
2011-11-22 04:53:38 +01:00
Alexander Sulfrian
5d8c8bbcdc fix recognition of query format for empty queries in dictionary format
queries like {text: ""} did not get recognized correctly before and
get converted to {text: {text: ""}}
2011-11-22 04:53:38 +01:00
Christophe Macabiau
f3c8b972fe query cancellation 2011-11-02 16:07:14 +01:00
brianc
06585d6e2c require 'util' instead of 'sys' 2011-10-10 19:40:52 -05:00
booo
5f7e85162a lib/client: added optional callback function to client.prototype.connect(); issue #52 2011-10-03 03:26:49 -05:00
brianc
ec1c70c4b5 ability to pause/resume drain event for long-running async transactions 2011-08-29 23:43:36 -05:00
brianc
cc77a67745 remove double init of variable 2011-06-02 07:24:42 -05:00
brianc
c1b5fe2ab0 native 'notify' and 'notification' events 2011-03-04 20:04:59 +00:00
brianc
bbe704b8db merged master 2011-03-04 19:32:54 +00:00
brianc
1cd1721f7f integration notification tests 2011-03-04 19:30:19 +00:00
brianc
749531f597 notification message 2011-03-03 23:20:47 -06:00
brianc
13a5803aac Merge branch 'master' into libpq 2011-03-03 22:45:00 -06:00
brianc
ec158770f5 client emits notify message from connection 2011-03-03 22:44:31 -06:00
brianc
5459773b90 properly emit notice messages on client 2011-03-03 23:30:17 +00:00