File tree 3 files changed +12
-0
lines changed
3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,10 @@ class Client extends EventEmitter {
498
498
}
499
499
this . blocked = query . blocking
500
500
this . sentQueryQueue . push ( query )
501
+ if ( query . name ) {
502
+ console . log ( `we store that ${ query . name } has been submitted` )
503
+ this . connection . submittedNamedStatements [ query . name ] = query . text
504
+ }
501
505
}
502
506
503
507
if ( this . readyForQuery === true ) {
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ class Connection extends EventEmitter {
19
19
this . _keepAliveInitialDelayMillis = config . keepAliveInitialDelayMillis
20
20
this . lastBuffer = false
21
21
this . parsedStatements = { }
22
+ // to track preparation of statements submitted to server
23
+ this . submittedNamedStatements = { }
22
24
this . ssl = config . ssl || false
23
25
this . _ending = false
24
26
this . _emitMessage = false
Original file line number Diff line number Diff line change @@ -160,6 +160,12 @@ class Query extends EventEmitter {
160
160
}
161
161
162
162
hasBeenParsed ( connection ) {
163
+ if ( connection . submittedNamedStatements [ this . name ] ) {
164
+ console . log ( `-----------------------------------` )
165
+ console . log ( `query.hasBeenParsed : This statement has already been prepared` )
166
+ console . log ( `-----------------------------------` )
167
+ return true
168
+ }
163
169
return this . name && connection . parsedStatements [ this . name ]
164
170
}
165
171
You can’t perform that action at this time.
0 commit comments