-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Adding in Extended Result Codes functionality to sqlite3 and pdo_sqlite extensions #4166
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
Conversation
… Attribute lastExtendedErrorCode() - calls sqlite3_extended_errcode instead of sqlite3_errcode toggleExtendedResultCodes(bool) - calls sqlite3_extended_result_codes PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES - new Attribute used in pdo_sqlite_set_attr in ../ext/pdo_sqlite/sqlite_driver.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is no tests for these new methods and attribute option, all of this needs to be covered and make sure that no other tests fail due to these additions.
If you need help writing test cases, you can read more about that on the QA website:
http://qa.php.net/write-test.php
…_INFO_EX. Correctly registering PDO class const.
4869458
to
5ecbf6c
Compare
@KalleZ I've added in the required things I missed (Thank you! I thought those functions looked important...) and i'm in the process of writing the UTs for these now. |
014e55b
to
3633c60
Compare
… lastExtendedErrorCode, and pdo_sqlite PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES
3633c60
to
6a548a1
Compare
Hmm, the UTs are acting differently than how they do on my test machine. I think it has to do with some SQLlite3 version differences. I'll have to play around and check it out. |
…ublicly for PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES
f0bd8ab
to
db046a3
Compare
@rkopack Thank you for the changes, lets see what the CI tools say now :) |
@KalleZ Looks like the UT are all good now (at least according to the CI tools) so let me know if you think they are acceptable in terms of coverage. I know there's been some discussion on the mailing list about possibly changing the SQLite3::enableExceptions() function and depending on where that goes I would change the toggleExtendedResultCodes() to follow suit (in terms of function prototype and return) I still need to look around about the return codes with regards to UT and checking returns but I think we don't need to do anything because, by default, the extendedResultCodes are turned off. Because result codes are unique per connection (including the errmask for result codes) I would like to believe that if somebody were to turn them on somewhere in the code they would check for the extended codes from that. But I am probably not fully understanding the concern that was brought up because of my lack of familiarity with the codebase. |
Whoops that was the wrong button ... you think it'd give you an "Are you sure?"! |
Hi! Sorry I have been busy the last few days, but thinking about it, then I think we should strive for consistency despite the original naming is not ideal imo, but it is what it is so I think we should go along the As for the What are your thoughts? |
Sounds good to me, Kalle! I'll make the changes for my code sometime this week. |
Thank you! Just let me know when you want a review and ping/tag me and I will take a look Thanks for your work |
…f enableExceptions for consistency. The new function name is enableExtendedResultCodes
70082f0
to
32b3246
Compare
@KalleZ I actually had some time to make the change yesterday so I believe the code is in a good place now. Let me know what your thoughts are! And thank you for your work too! I have to say, I was initially nervous about jumping into this but it's been a very good experience so far and part of that has been how kind the tone has been from everybody I've spoken to. |
Hello again it's been about a week and just wanted to give this a bump. |
To clarify, is this what the PR implements?
If so, I feel like there is quite a bit of duplication here. If we have the attribute, why do we also need the extra enable method? Do we need both the ability to make the existing error code interfaces return extended codes and have a separate method to fetch them (possibly we do, I don't know)? |
That is slightly incorrect. The following functionality is being added:
The 2 sqlite3 methods will allow users of that class to both fetch and enable/disable the extended error code functionality. The sqlite3 PDO attribute will allow users of the that class to enable/disable the extended error code functionality. I should probably add in a way for the PDO to fetch the extended error functionality as well however I don't know the best way to expose the functionality. |
Oh sorry, I totally missed that this is working on two separate extensions. This makes a lot more sense to me now... |
Merged as b546ae9 into 7.4. Thanks, and sorry for the delay! |
Adding in two new functions to ..\ext\sqlite3\sqlite3.c and a new PDO Attribute
lastExtendedErrorCode() - calls sqlite3_extended_errcode instead of sqlite3_errcode
toggleExtendedResultCodes(bool) - calls sqlite3_extended_result_codes
PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES - new Attribute used in pdo_sqlite_set_attr in ../ext/pdo_sqlite/sqlite_driver.c