File tree 2 files changed +21
-3
lines changed
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 @@ -628,6 +628,20 @@ t('unsafe describe', async() => {
628
628
]
629
629
} )
630
630
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
+
631
645
t ( 'listen and notify' , async ( ) => {
632
646
const sql = postgres ( options )
633
647
const channel = 'hello'
You can’t perform that action at this time.
0 commit comments