Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Added transacting ability. #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,24 @@ function _buildSquel(flavour = null) {
this._setValue(limit);
}
}

// FOR SHARE/FOR UPDATE
cls.TransactionBlock = class extends cls.AbstractVerbSingleValueBlock {
constructor(options) {
super(_extend({}, options, {
verb: 'FOR'
}));
}

/**
# Set the transact transformation.
#
# @param forUpdate {Boolean} If true, it will use the FOR UPDATE statement, else it will use the FOR SHARE statement.
*/
transact (forUpdate) {
this._setValue(forUpdate ? ' UPDATE' : ' SHARE');
}
}



Expand Down Expand Up @@ -2090,6 +2108,7 @@ function _buildSquel(flavour = null) {
new cls.LimitBlock(options),
new cls.OffsetBlock(options),
new cls.UnionBlock(options),
new cls.TransactionBlock(options),
];

super(options, blocks);
Expand Down