11.09.2013, 01:16
Why does 'mysql_connect' always returns a positive handle with a failed connection? Even 'mysql_errno' doesn't seem to be working.
pawn Код:
//Testing code
printf("%d", mysql_connect(SQL_HOST, SQL_USER, "db1", SQL_PWD)); //Correct db
printf("%d", mysql_errno());
printf("%d", mysql_connect(SQL_HOST, SQL_USER, "123456", SQL_PWD)); //Invalid db
printf("%d", mysql_errno());
printf("%d", mysql_connect(SQL_HOST, SQL_USER, "db2", SQL_PWD)); //Correct db
printf("%d", mysql_errno());
Код:
//Output 1 0 2 0 3 0