MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:February 19 2008 3:59pm
Subject:Re: bk commit into 5.0 tree (holyfoot:1.2594) BUG#25097
View as plain text  
Hi!

On Feb 17, holyfoot@stripped wrote:
> ChangeSet@stripped, 2008-02-17 18:15:01+04:00, holyfoot@stripped +5 -0
>   Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
>   
>   There was no way to return an error from the client library
>   if no MYSQL connections was established.
>   So here i added variables to store that king of errors and
>   made functions like mysql_error(NULL) to return these.
> 
> diff -Nrup a/libmysql/libmysql.c b/libmysql/libmysql.c
> --- a/libmysql/libmysql.c	2007-11-26 20:09:35 +04:00
> +++ b/libmysql/libmysql.c	2008-02-17 18:14:59 +04:00
> @@ -1486,7 +1486,7 @@ my_ulonglong STDCALL mysql_insert_id(MYS
>  
>  const char *STDCALL mysql_sqlstate(MYSQL *mysql)
>  {
> -  return mysql->net.sqlstate;
> +  return mysql ? mysql->net.sqlstate : unknown_sqlstate;

There're more appropriate sqlstates:

08003 connection does not exist
08006 connection failure
08002 connection name in use
08001 SQL-client unable to establish SQL-connection
08004 SQL-server rejected establishment of SQL-connection
08007 transaction resolution unknown

for example 08001 seems to be good enough here.
(may be defined in client.c as cant_connect_sqlstate, or whatever)

ok to push
with a changed sqlstate, and don't forget to add a comment to the
bugreport explaining API extension for the manual.

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer/Server Architect
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Dachauer Str. 37, D-80335 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
bk commit into 5.0 tree (holyfoot:1.2594) BUG#25097holyfoot17 Feb
  • Re: bk commit into 5.0 tree (holyfoot:1.2594) BUG#25097Sergei Golubchik19 Feb