File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -139,19 +139,25 @@ class PlanetScaleConnection implements DatabaseConnection {
139
139
140
140
async beginTransaction ( ) {
141
141
this . #transactionClient = this . #transactionClient ?? new PlanetScaleConnection ( this . #config)
142
- this . #transactionClient. #conn. execute ( 'BEGIN' )
142
+ await this . #transactionClient. #conn. execute ( 'BEGIN' )
143
143
}
144
144
145
145
async commitTransaction ( ) {
146
146
if ( ! this . #transactionClient) throw new Error ( 'No transaction to commit' )
147
- this . #transactionClient. #conn. execute ( 'COMMIT' )
148
- this . #transactionClient = undefined
147
+ try {
148
+ await this . #transactionClient. #conn. execute ( 'COMMIT' )
149
+ } finally {
150
+ this . #transactionClient = undefined
151
+ }
149
152
}
150
153
151
154
async rollbackTransaction ( ) {
152
155
if ( ! this . #transactionClient) throw new Error ( 'No transaction to rollback' )
153
- this . #transactionClient. #conn. execute ( 'ROLLBACK' )
154
- this . #transactionClient = undefined
156
+ try {
157
+ await this . #transactionClient. #conn. execute ( 'ROLLBACK' )
158
+ } finally {
159
+ this . #transactionClient = undefined
160
+ }
155
161
}
156
162
157
163
async * streamQuery < O > ( _compiledQuery : CompiledQuery , _chunkSize : number ) : AsyncIterableIterator < QueryResult < O > > {
You can’t perform that action at this time.
0 commit comments