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

Server programs: try to print error message if can't connect to DB #3672

Merged
merged 1 commit into from
May 7, 2020

Conversation

davidpanderson
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented May 2, 2020

Codecov Report

Merging #3672 into master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #3672   +/-   ##
=========================================
  Coverage     18.90%   18.90%           
  Complexity      751      751           
=========================================
  Files           105      105           
  Lines          8654     8654           
  Branches       1524     1524           
=========================================
  Hits           1636     1636           
  Misses         6903     6903           
  Partials        115      115           

@@ -85,10 +85,14 @@ int DB_CONN::open(
// CLIENT_FOUND_ROWS means that the # of affected rows for an update
// is the # matched by the where, rather than the # actually changed
//
mysql = mysql_real_connect(
MYSQL* mysql2 = mysql_real_connect(
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason of adding new variable here? In case of unsuccessful connect, mysql variable will still be uninitialized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the connect failed, mysql will be NULL. mysql_errno() and mysql_error() require a non-NULL argument.

Copy link
Member

@AenBleidd AenBleidd May 6, 2020

Choose a reason for hiding this comment

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

But will mysql contain relevant error information then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It will contain info about the fail connect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants