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

Transaction commit always throws TransactionHaltException #1

Closed
nrwiersma opened this issue Jan 10, 2017 · 3 comments
Closed

Transaction commit always throws TransactionHaltException #1

nrwiersma opened this issue Jan 10, 2017 · 3 comments

Comments

@nrwiersma
Copy link

Hey,

I noticed that on committing a transaction, it always throws a TransactionHaltException, which seems a little weird. Is there a particular reason for this?

That aside, I have been looking for a standalone QueryBuilder for some time, and this looks awesome.

Thanks.

@adambanaszkiewicz
Copy link
Owner

adambanaszkiewicz commented Jan 10, 2017

Hi,

Wow, I've just create this repo few hours ago :)

This is, because:

  1. Start transaction and commit it - waiting for some of exceptions.
  2. If transation od DB fails, PDO throws own exceptions which is cought by code and rolled back.
  3. If transaction ends succesfully, app throws own error and do nothing else.

This give me ability to create little more extensible code, without ifs, additionally variables etc. It looks little wierd but it works fine :)

This is really alpha version. I tests only few percent of code. In next days/weeks I write rest of the tests, but for now, some of the functions can mess up. As You can see, even documentation isn't written. I'll be really happy if You use my code in Your project and write me some callback about it :)

Actually I write this QueryBuilder for the same reason - I need standalone QB for my project, and none of that I've found is good enough for me. There is some work with this repo, but basic functionality is implemented.

Best.

@nrwiersma
Copy link
Author

Hey,

Like i said, always look for something like this :)

Surely your successful case can return normally, and any errors, or rollback for that matter, can throw an exception. It is a bit of code smell that success throws an exception. This is however pure opinion.

Looking into how I can integrate today and tomorrow, and will see how it goes. Will let you know what I find.

Later.

@adambanaszkiewicz
Copy link
Owner

adambanaszkiewicz commented Jan 10, 2017

Yes, You have right. I think I need to rewrite this thing.

Thank You for Your opinion.

About integration please see the TestCase.php file, and see how You can push PDO connection object to QueryBuilder to use current connection with this repo:

https://github.com/requtize/query-builder/blob/master/tests/unit/TestCase.php#L35

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

No branches or pull requests

2 participants