File tree 2 files changed +31
-3
lines changed
2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ var Query = function(config) {
9
9
this . rows = config . rows ;
10
10
this . types = config . types ;
11
11
this . name = config . name ;
12
+ //use unique portal name each time
13
+ this . portal = config . portal || ""
12
14
this . callback = config . callback ;
13
15
this . _fieldNames = [ ] ;
14
16
this . _fieldConverters = [ ] ;
@@ -101,7 +103,7 @@ p.hasBeenParsed = function(connection) {
101
103
102
104
p . getRows = function ( connection ) {
103
105
connection . execute ( {
104
- portal : this . name ,
106
+ portal : this . portalName ,
105
107
rows : this . rows
106
108
} , true ) ;
107
109
connection . flush ( ) ;
@@ -131,14 +133,14 @@ p.prepare = function(connection) {
131
133
132
134
//http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
133
135
connection . bind ( {
134
- portal : self . name ,
136
+ portal : self . portalName ,
135
137
statement : self . name ,
136
138
values : self . values
137
139
} , true ) ;
138
140
139
141
connection . describe ( {
140
142
type : 'P' ,
141
- name : self . name || ""
143
+ name : self . portalName || ""
142
144
} , true ) ;
143
145
144
146
this . getRows ( connection ) ;
Original file line number Diff line number Diff line change @@ -46,3 +46,29 @@ test('a single connection transaction', function() {
46
46
47
47
} ) )
48
48
} )
49
+
50
+ test ( 'gh#36' , function ( ) {
51
+ var connectionString = helper . connectionString ( ) ;
52
+ helper . pg . connect ( connectionString , function ( err , client ) {
53
+ if ( err ) throw err ;
54
+ client . query ( "BEGIN" ) ;
55
+ client . query ( {
56
+ name : 'X' ,
57
+ text : "SELECT $1::INTEGER" ,
58
+ values : [ 0 ]
59
+ } , assert . calls ( function ( err , result ) {
60
+ if ( err ) throw err ;
61
+ assert . equal ( result . rows . length , 1 ) ;
62
+ } ) )
63
+ client . query ( {
64
+ name : 'X' ,
65
+ text : "SELECT $1::INTEGER" ,
66
+ values : [ 0 ]
67
+ } , assert . calls ( function ( err , result ) {
68
+ if ( err ) throw err ;
69
+ assert . equal ( result . rows . length , 1 ) ;
70
+ } ) )
71
+ client . query ( "COMMIT" )
72
+ client . on ( 'drain' , client . end . bind ( client ) )
73
+ } )
74
+ } )
You can’t perform that action at this time.
0 commit comments