File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 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 {
139139
140140 async beginTransaction ( ) {
141141 this . #transactionClient = this . #transactionClient ?? new PlanetScaleConnection ( this . #config)
142- this . #transactionClient. #conn. execute ( 'BEGIN' )
142+ await this . #transactionClient. #conn. execute ( 'BEGIN' )
143143 }
144144
145145 async commitTransaction ( ) {
146146 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+ }
149152 }
150153
151154 async rollbackTransaction ( ) {
152155 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+ }
155161 }
156162
157163 async * streamQuery < O > ( _compiledQuery : CompiledQuery , _chunkSize : number ) : AsyncIterableIterator < QueryResult < O > > {
You can’t perform that action at this time.
0 commit comments