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

MySQL1 not closing connection #140

Open
timothyao opened this issue Sep 12, 2022 · 2 comments
Open

MySQL1 not closing connection #140

timothyao opened this issue Sep 12, 2022 · 2 comments

Comments

@timothyao
Copy link

timothyao commented Sep 12, 2022

MySQL1 not closing connection in a Dart console application running on Windows 10, in debug mode. Find an example of the code structure below:

final conn = await MySqlConnection.connect(_settings);
Results results;

      if (branches.isNotEmpty) {
        for (var branch in branches) {
                await conn.query('INSERT INTO branches (id, name) VALUES (?,?)', [branch.id, branch.name]);
          }
        }

await conn.close();

Thanks in advance.

@berkayhh
Copy link

You dont need an Await Func. Try it only conn.close();

@timothyao
Copy link
Author

Hi @berkayhh,

Thanks for the suggestion, but I am curious to why you think removing the await function would work. From my limited knowledge, an await will wait till the connection is closed before proceeding with the next line of code. Or am I missing something?

Best Regards

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