Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Feb 7, 2025

The PR fixes sqltest.SQLite usages and implementation by adding the missing sdb.Close() and source.Close().

sqltest.SQLite returns *sql.DB, which we need to close as shown here:

db, cleanup := sqltest.CreateSQLiteDatabase(t, dsn, []string{s})
defer db.Close()
defer cleanup()

os.CreateTemp creates a new temporary file in the directory dir, opens the file for reading and writing, and returns the resulting file. We also need to close it.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 7, 2025
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 7, 2025
@kyleconroy kyleconroy merged commit 6dacff2 into sqlc-dev:main Feb 7, 2025
8 checks passed
@kyleconroy
Copy link
Collaborator

Thanks!

@alexandear alexandear deleted the fix-add-missing-close branch February 7, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants