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
Closed

add forUpdate expression #84

khomyakov42 opened this issue Oct 1, 2013 · 7 comments

Comments

@khomyakov42
Copy link

@khomyakov42 khomyakov42 commented Oct 1, 2013

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

@tgriesser
Copy link
Member

@tgriesser 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?

Loading

@khomyakov42
Copy link
Author

@khomyakov42 khomyakov42 commented Oct 2, 2013

Yes

Loading

@tgriesser
Copy link
Member

@tgriesser tgriesser commented Oct 14, 2013

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

Loading

@tgriesser tgriesser closed this Oct 14, 2013
@gx0r
Copy link
Contributor

@gx0r gx0r 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'

Loading

@tgriesser
Copy link
Member

@tgriesser tgriesser commented Feb 27, 2014

Fixing now.

Loading

tgriesser added a commit that referenced this issue Feb 27, 2014
@tgriesser
Copy link
Member

@tgriesser tgriesser commented Feb 27, 2014

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

Loading

@gx0r
Copy link
Contributor

@gx0r gx0r commented Feb 27, 2014

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants