@@ -129,7 +129,7 @@ class Client extends EventEmitter {
129129 // Error all queued queries
130130 this . _queryQueue . forEach ( enqueueError )
131131 this . _queryQueue . length = 0
132-
132+
133133 // Error all pipeline queries
134134 if ( this . _pipelining ) {
135135 this . _pipelineQueue . forEach ( enqueueError )
@@ -364,7 +364,7 @@ class Client extends EventEmitter {
364364 }
365365 this . emit ( 'connect' )
366366 }
367-
367+
368368 if ( this . _pipelining ) {
369369 // In pipeline mode, readyForQuery indicates end of current query in pipeline
370370 const activeQuery = this . _getActiveQuery ( )
@@ -376,7 +376,7 @@ class Client extends EventEmitter {
376376 this . _pipelineQueue . splice ( index , 1 )
377377 }
378378 }
379-
379+
380380 // Set next query as active if available
381381 if ( this . _pipelineQueue . length > 0 ) {
382382 this . _activeQuery = this . _pipelineQueue [ 0 ]
@@ -393,7 +393,7 @@ class Client extends EventEmitter {
393393 activeQuery . handleReadyForQuery ( this . connection )
394394 }
395395 }
396-
396+
397397 this . _pulseQueryQueue ( )
398398 }
399399
@@ -575,7 +575,7 @@ class Client extends EventEmitter {
575575 if ( this . _pipelining ) {
576576 return this . _pipelinePulseQueryQueue ( )
577577 }
578-
578+
579579 if ( this . readyForQuery === true ) {
580580 this . _activeQuery = this . _queryQueue . shift ( )
581581 const activeQuery = this . _getActiveQuery ( )
@@ -634,7 +634,7 @@ class Client extends EventEmitter {
634634 if ( typeof config === 'string' ) {
635635 throw new Error ( 'Simple query protocol is not allowed in pipeline mode. Use parameterized queries instead.' )
636636 }
637- if ( query . text && query . text . includes ( ';' ) && query . text . trim ( ) . split ( ';' ) . filter ( s => s . trim ( ) ) . length > 1 ) {
637+ if ( query . text && query . text . includes ( ';' ) ) {
638638 throw new Error ( 'Multiple SQL commands in a single query are not allowed in pipeline mode.' )
639639 }
640640 }
@@ -747,15 +747,15 @@ class Client extends EventEmitter {
747747 if ( typeof value !== 'boolean' ) {
748748 throw new TypeError ( 'pipelining must be a boolean' )
749749 }
750-
750+
751751 if ( value && ! this . _connected ) {
752752 throw new Error ( 'Cannot enable pipelining before connection is established' )
753753 }
754-
754+
755755 if ( value && this . _getActiveQuery ( ) ) {
756756 throw new Error ( 'Cannot enable pipelining while a query is active' )
757757 }
758-
758+
759759 if ( value && ! this . _pipelining ) {
760760 this . _enterPipelineMode ( )
761761 } else if ( ! value && this . _pipelining ) {
@@ -771,15 +771,15 @@ class Client extends EventEmitter {
771771 if ( this . _pipelining ) {
772772 return
773773 }
774-
774+
775775 if ( ! this . _connected ) {
776776 throw new Error ( 'Cannot enter pipeline mode before connection is established' )
777777 }
778-
778+
779779 if ( this . _getActiveQuery ( ) ) {
780780 throw new Error ( 'Cannot enter pipeline mode while a query is active' )
781781 }
782-
782+
783783 this . _pipelining = true
784784 this . _pipelineQueue = [ ]
785785 this . _pipelineSync = false
@@ -789,31 +789,31 @@ class Client extends EventEmitter {
789789 if ( ! this . _pipelining ) {
790790 return
791791 }
792-
792+
793793 // Send sync to end pipeline if we have pending queries
794794 if ( this . _pipelineQueue . length > 0 && ! this . _pipelineSync ) {
795795 this . connection . sync ( )
796796 this . _pipelineSync = true
797797 }
798-
798+
799799 this . _pipelining = false
800800 }
801801
802802 _pipelinePulseQueryQueue ( ) {
803803 if ( ! this . _pipelining ) {
804804 return this . _pulseQueryQueue ( )
805805 }
806-
806+
807807 // In pipeline mode, send all queued queries immediately without waiting for responses
808808 while ( this . _queryQueue . length > 0 ) {
809809 const query = this . _queryQueue . shift ( )
810810 this . _pipelineQueue . push ( query )
811-
811+
812812 // Force extended query protocol for pipeline mode
813813 if ( ! query . requiresPreparation ( ) ) {
814814 query . queryMode = 'extended'
815815 }
816-
816+
817817 const queryError = query . submit ( this . connection )
818818 if ( queryError ) {
819819 process . nextTick ( ( ) => {
@@ -827,12 +827,12 @@ class Client extends EventEmitter {
827827 continue
828828 }
829829 }
830-
830+
831831 // Set active query to first in pipeline if we don't have one
832832 if ( ! this . _getActiveQuery ( ) && this . _pipelineQueue . length > 0 ) {
833833 this . _activeQuery = this . _pipelineQueue [ 0 ]
834834 }
835-
835+
836836 this . readyForQuery = true
837837 }
838838}
0 commit comments