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 {
54
54
return this . canceller && ( this . canceller ( this ) , this . canceller = null )
55
55
}
56
56
57
- async readable ( ) {
57
+ simple ( ) {
58
58
this . options . simple = true
59
59
this . options . prepare = false
60
+ return this
61
+ }
62
+
63
+ async readable ( ) {
64
+ this . simple ( )
60
65
this . streaming = true
61
66
return this
62
67
}
63
68
64
69
async writable ( ) {
65
- this . options . simple = true
66
- this . options . prepare = false
70
+ this . simple ( )
67
71
this . streaming = true
68
72
return this
69
73
}
Original file line number Diff line number Diff line change @@ -629,6 +629,20 @@ t('unsafe describe', async() => {
629
629
]
630
630
} )
631
631
632
+ t ( 'simple query using unsafe with multiple statements' , async ( ) => {
633
+ return [
634
+ '1,2' ,
635
+ ( await sql . unsafe ( 'select 1 as x;select 2 as x' ) ) . map ( x => x [ 0 ] . x ) . join ( )
636
+ ]
637
+ } )
638
+
639
+ t ( 'simple query using simple() with multiple statements' , async ( ) => {
640
+ return [
641
+ '1,2' ,
642
+ ( await sql `select 1 as x;select 2 as x` . simple ( ) ) . map ( x => x [ 0 ] . x ) . join ( )
643
+ ]
644
+ } )
645
+
632
646
t ( 'listen and notify' , async ( ) => {
633
647
const sql = postgres ( options )
634
648
const channel = 'hello'
You can’t perform that action at this time.
0 commit comments