File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 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 {
498498 }
499499 this . blocked = query . blocking
500500 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+ }
501505 }
502506
503507 if ( this . readyForQuery === true ) {
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ class Connection extends EventEmitter {
1919 this . _keepAliveInitialDelayMillis = config . keepAliveInitialDelayMillis
2020 this . lastBuffer = false
2121 this . parsedStatements = { }
22+ // to track preparation of statements submitted to server
23+ this . submittedNamedStatements = { }
2224 this . ssl = config . ssl || false
2325 this . _ending = false
2426 this . _emitMessage = false
Original file line number Diff line number Diff line change @@ -160,6 +160,12 @@ class Query extends EventEmitter {
160160 }
161161
162162 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+ }
163169 return this . name && connection . parsedStatements [ this . name ]
164170 }
165171
You can’t perform that action at this time.
0 commit comments