-
Notifications
You must be signed in to change notification settings - Fork 443
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
Conversation
Codecov Report
@@ 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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
No description provided.