File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,20 @@ export class Query extends Promise {
5454 return this . canceller && ( this . canceller ( this ) , this . canceller = null )
5555 }
5656
57- async readable ( ) {
57+ simple ( ) {
5858 this . options . simple = true
5959 this . options . prepare = false
60+ return this
61+ }
62+
63+ async readable ( ) {
64+ this . simple ( )
6065 this . streaming = true
6166 return this
6267 }
6368
6469 async writable ( ) {
65- this . options . simple = true
66- this . options . prepare = false
70+ this . simple ( )
6771 this . streaming = true
6872 return this
6973 }
Original file line number Diff line number Diff line change @@ -628,6 +628,20 @@ t('unsafe describe', async() => {
628628 ]
629629} )
630630
631+ t ( 'simple query using unsafe with multiple statements' , async ( ) => {
632+ return [
633+ '1,2' ,
634+ ( await sql . unsafe ( 'select 1 as x;select 2 as x' ) ) . map ( x => x [ 0 ] . x ) . join ( )
635+ ]
636+ } )
637+
638+ t ( 'simple query using simple() with multiple statements' , async ( ) => {
639+ return [
640+ '1,2' ,
641+ ( await sql `select 1 as x;select 2 as x` . simple ( ) ) . map ( x => x [ 0 ] . x ) . join ( )
642+ ]
643+ } )
644+
631645t ( 'listen and notify' , async ( ) => {
632646 const sql = postgres ( options )
633647 const channel = 'hello'
You can’t perform that action at this time.
0 commit comments