@@ -55,7 +55,8 @@ class Session {
55
55
private _writeConnectionHolder : ConnectionHolder
56
56
private _open : boolean
57
57
private _hasTx : boolean
58
- private _lastBookmark : Bookmark
58
+ private _bookmarkIn : Bookmark
59
+ private _bookmarkOut ?: string
59
60
private _transactionExecutor : TransactionExecutor
60
61
private _impersonatedUser ?: string
61
62
private _onComplete : ( meta : any ) => void
@@ -117,7 +118,7 @@ class Session {
117
118
this . _open = true
118
119
this . _hasTx = false
119
120
this . _impersonatedUser = impersonatedUser
120
- this . _lastBookmark = bookmark || Bookmark . empty ( )
121
+ this . _bookmarkIn = bookmark || Bookmark . empty ( )
121
122
this . _transactionExecutor = _createTransactionExecutor ( config )
122
123
this . _onComplete = this . _onCompleteCallback . bind ( this )
123
124
this . _databaseNameResolved = this . _database !== ''
@@ -150,7 +151,7 @@ class Session {
150
151
return this . _run ( validatedQuery , params , connection => {
151
152
this . _assertSessionIsOpen ( )
152
153
return ( connection as Connection ) . protocol ( ) . run ( validatedQuery , params , {
153
- bookmark : this . _lastBookmark ,
154
+ bookmark : this . _bookmarkIn ,
154
155
txConfig : autoCommitTxConfig ,
155
156
mode : this . _mode ,
156
157
database : this . _database ,
@@ -271,7 +272,7 @@ class Session {
271
272
reactive : this . _reactive ,
272
273
fetchSize : this . _fetchSize
273
274
} )
274
- tx . _begin ( this . _lastBookmark , txConfig )
275
+ tx . _begin ( this . _bookmarkIn , txConfig )
275
276
return tx
276
277
}
277
278
@@ -296,10 +297,10 @@ class Session {
296
297
/**
297
298
* Return the bookmark received following the last completed {@link Transaction}.
298
299
*
299
- * @return {string[] } A reference to a previous transaction.
300
+ * @return {string | undefined } A reference to a previous transaction if present .
300
301
*/
301
- lastBookmark ( ) : string [ ] {
302
- return this . _lastBookmark . values ( )
302
+ lastBookmark ( ) : string | undefined {
303
+ return this . _bookmarkOut
303
304
}
304
305
305
306
/**
@@ -360,7 +361,7 @@ class Session {
360
361
/**
361
362
* Sets the resolved database name in the session context.
362
363
* @private
363
- * @param {string| undefined } database The resolved database name
364
+ * @param {string | undefined } database The resolved database name
364
365
* @returns {void }
365
366
*/
366
367
_onDatabaseNameResolved ( database ?: string ) : void {
@@ -376,12 +377,13 @@ class Session {
376
377
/**
377
378
* Update value of the last bookmark.
378
379
* @private
379
- * @param {Bookmark } newBookmark - The new bookmark.
380
+ * @param {string | undefined } newBookmark - The new bookmark.
380
381
* @returns {void }
381
382
*/
382
- _updateBookmark ( newBookmark ?: Bookmark ) : void {
383
- if ( newBookmark && ! newBookmark . isEmpty ( ) ) {
384
- this . _lastBookmark = newBookmark
383
+ _updateBookmark ( newBookmark ?: string ) : void {
384
+ if ( newBookmark !== undefined ) {
385
+ this . _bookmarkIn = new Bookmark ( newBookmark )
386
+ this . _bookmarkOut = newBookmark
385
387
}
386
388
}
387
389
@@ -414,8 +416,8 @@ class Session {
414
416
* @param {Object } meta Connection metadatada
415
417
* @returns {void }
416
418
*/
417
- _onCompleteCallback ( meta : { bookmark : string | string [ ] } ) : void {
418
- this . _updateBookmark ( new Bookmark ( meta . bookmark ) )
419
+ _onCompleteCallback ( meta : { bookmark : string } ) : void {
420
+ this . _updateBookmark ( meta . bookmark )
419
421
}
420
422
421
423
/**
0 commit comments