Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add forUpdate expression #84

Closed
khomyakov42 opened this Issue Oct 1, 2013 · 7 comments

Comments

Projects
None yet
3 participants
@khomyakov42
Copy link

khomyakov42 commented Oct 1, 2013

SELECT * FROM tableName WHERE ... LIMIT .. FOR UPDATE

@tgriesser

This comment has been minimized.

Copy link
Owner

tgriesser commented Oct 1, 2013

So since forUpdate would only be applicable in the context of a transaction, would it make sense that this method (and potentially others relating to transactions forShare) be dynamically made available after calling the .transacting(trx) on the query builder chain?

@khomyakov42

This comment has been minimized.

Copy link
Author

khomyakov42 commented Oct 2, 2013

Yes

@tgriesser

This comment has been minimized.

Copy link
Owner

tgriesser commented Oct 14, 2013

@glasscube42 - take a look, should be added & documented now.

@tgriesser tgriesser closed this Oct 14, 2013

@llambda

This comment has been minimized.

Copy link
Contributor

llambda commented Feb 27, 2014

I seem to be having trouble with forUpdate against postgresql with knex 0.5.7. Code is..

knex.transaction(function(t) {
    return knex('users')
      .transacting(t)
      .forUpdate()
      .then(function (s) {
        console.log(s);
        return s;
      });
})
.then(function(resp) {
  console.log('TX complete! ' + JSON.stringify(resp));
  return resp;
})
.catch(function(err) {
    console.log('TX error! ' + err.message);
});

Outputs: 'TX error! Cannot call method 'then' of undefined'

@tgriesser

This comment has been minimized.

Copy link
Owner

tgriesser commented Feb 27, 2014

Fixing now.

tgriesser added a commit that referenced this issue Feb 27, 2014

@tgriesser

This comment has been minimized.

Copy link
Owner

tgriesser commented Feb 27, 2014

@llambda thanks for pointing this out... should be fixed, let me know if it's not working for you.

@llambda

This comment has been minimized.

Copy link
Contributor

llambda commented Feb 27, 2014

@tgriesser Works good now. Thank you for fixing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.