Skip to content

Add Database::tryExec()#311

Merged
SRombauts merged 1 commit intoSRombauts:masterfrom
kcowolf:master
Nov 25, 2020
Merged

Add Database::tryExec()#311
SRombauts merged 1 commit intoSRombauts:masterfrom
kcowolf:master

Conversation

@kcowolf
Copy link
Copy Markdown
Contributor

@kcowolf kcowolf commented Nov 12, 2020

Similar to Statement::tryExecuteStep(), allows calls to sqlite3_exec() with the caller assuming responsibility for checking and handling the returned status.

Similar to Statement::tryExecuteStep(), allows calls to sqlite3_exec()
with the caller assuming responsibility for checking and handling the
returned status.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 1d0d8fe on kcowolf:master into adb7e7c on SRombauts:master.

@SRombauts
Copy link
Copy Markdown
Owner

Hello!
I find this to be useful. But I am really hesitant about the name, since it doesn't convey exactly the fact that it doesn't deal with exceptions (quite the opposite with the "try" keyword)
Or is this a sort of naming convention I am unaware of?

@kcowolf
Copy link
Copy Markdown
Contributor Author

kcowolf commented Nov 25, 2020

I was trying to follow Statement::tryExecuteStep(), which similarly doesn't throw exceptions (compared to Statement::executeStep and Statement::exec, which do).

Also, C# has some "Try" functions which behave similarly. For example, int.TryParse() versus int.Parse(). int.TryParse() returns false if the string can't be parsed as an integer, while int.Parse() throws an exception. https://stackoverflow.com/questions/467613/parse-v-tryparse

I'd be fine with renaming it if you prefer, though. It just made sense to me based on the above.

@SRombauts SRombauts merged commit 845f315 into SRombauts:master Nov 25, 2020
@SRombauts
Copy link
Copy Markdown
Owner

Then it's settled, thank you!

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

Successfully merging this pull request may close these issues.

3 participants