@@ -8,8 +8,8 @@ export interface ICursor<T> {
88}
99
1010export interface IDatabaseConnection {
11- query : ( query : string , bindings : any [ ] ) => Promise < { rows : any [ ] } > ;
12- stream ?: ( query : string , bindings : any [ ] ) => ICursor < any [ ] > ;
11+ query : ( config : { text : string ; values : any [ ] } ) => Promise < { rows : any [ ] } > ;
12+ stream ?: ( config : { text : string ; values : any [ ] } ) => ICursor < any [ ] > ;
1313}
1414
1515/** Check for column modifier suffixes (exclamation and question marks). */
@@ -55,7 +55,10 @@ export class TaggedQuery<TTypePair extends { params: any; result: any }> {
5555 this . query ,
5656 params as any ,
5757 ) ;
58- const result = await connection . query ( processedQuery , bindings ) ;
58+ const result = await connection . query ( {
59+ text : processedQuery ,
60+ values : bindings ,
61+ } ) ;
5962 return mapQueryResultRows ( result . rows ) ;
6063 } ;
6164 this . stream = ( params , connection ) => {
@@ -65,7 +68,10 @@ export class TaggedQuery<TTypePair extends { params: any; result: any }> {
6568 ) ;
6669 if ( connection . stream == null )
6770 throw new Error ( "Connection doesn't support streaming." ) ;
68- const cursor = connection . stream ( processedQuery , bindings ) ;
71+ const cursor = connection . stream ( {
72+ text : processedQuery ,
73+ values : bindings ,
74+ } ) ;
6975 return {
7076 async read ( rowCount : number ) {
7177 const rows = await cursor . read ( rowCount ) ;
@@ -112,7 +118,10 @@ export class PreparedQuery<TParamType, TResultType> {
112118 this . queryIR ,
113119 params as any ,
114120 ) ;
115- const result = await connection . query ( processedQuery , bindings ) ;
121+ const result = await connection . query ( {
122+ text : processedQuery ,
123+ values : bindings ,
124+ } ) ;
116125 return mapQueryResultRows ( result . rows ) ;
117126 } ;
118127 this . stream = ( params , connection ) => {
@@ -122,7 +131,10 @@ export class PreparedQuery<TParamType, TResultType> {
122131 ) ;
123132 if ( connection . stream == null )
124133 throw new Error ( "Connection doesn't support streaming." ) ;
125- const cursor = connection . stream ( processedQuery , bindings ) ;
134+ const cursor = connection . stream ( {
135+ text : processedQuery ,
136+ values : bindings ,
137+ } ) ;
126138 return {
127139 async read ( rowCount : number ) {
128140 const rows = await cursor . read ( rowCount ) ;
0 commit comments