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

Finalize only if db is available #78

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Conversation

lekoala
Copy link
Collaborator

@lekoala lekoala commented Jun 26, 2024

Fixes #77

Description

See issue for context

Manual testing steps

Issues

#77

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

@lekoala
Copy link
Collaborator Author

lekoala commented Jun 26, 2024

pr failure not related
see no such function: FIELD => seems that the eager loading feature using sqlite incompatible syntax

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small suggested change, though I don't use sqlite so really it's up to you either way.

Would you like to be added as a maintainer for this module, since it's no longer commercially maintained?

@@ -39,7 +39,7 @@ public function __construct(SQLite3Connector $database, SQLite3Result $handle)

public function __destruct()
{
if ($this->handle) {
if ($this->handle && $this->database->getSelectedDatabase()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would isActive() be more appropriate to call here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes is active should work just as well but brings no additional benefit except being probably more correct semantically

https://github.com/silverstripe/silverstripe-sqlite3/blob/1e8d7357be321b3eb32a596538078fd65d0d357e/code/SQLite3Connector.php#L184C21-L188

if you see, unloading the db remove the databaseName and close the connection. isActive only checks if there is a dbConn object... and there would be a closed one. :-) so either way should work just fine. i don't think there is a way to check if the dbConn was indeed closed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup that's what I was thinking too. If you change it to isActive() I'll be happy to merge. I like semantically correct ;p

@lekoala
Copy link
Collaborator Author

lekoala commented Jul 10, 2024

@GuySartorelli i'm happy to be added as a maintainer but i know i'm obviously less strict than you guys are when it comes to releasing new versions ;-)
as long as you are comfortable if I merge things I see necessary in my projects then I'm happy to share what I find useful with the community
but i don't plan to add extra burden on my already busy schedule :-)

@GuySartorelli
Copy link
Member

GuySartorelli commented Jul 10, 2024

i know i'm obviously less strict than you guys are when it comes to releasing new versions ;-)

That's fine - this is no longer a commercially supported module, so it's not restricted by the minor or major release policies.

as long as you are comfortable if I merge things I see necessary in my projects then I'm happy to share what I find useful with the community

Yup, no worries there. It's effectively a community module at this stage - just no community member has stepped up to maintain it yet. I'll add you as a maintainer.

Edit: Ignore the email that invites you to a team - I thought I could create a repo-level team but that doesn't seem to be the case. I've added you as a maintainer directly to this repository.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, as you said, the ci failures are unrelated.

@GuySartorelli GuySartorelli merged commit 1c81f6f into silverstripe:3 Jul 11, 2024
7 of 9 checks passed
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.

Fatal error: Uncaught Error: The SQLite3Result object has not been correctly initialised or is already closed
2 participants