X-Account-Key: account4 X-UIDL: 1153746480.180773 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 X-Mozilla-Keys: Return-Path: Received: from mailget.mysql.com ([unix socket]) by mailget (Cyrus v2.3.1-Invoca-RPM-2.3.1-2.8.fc5) with LMTPA; Wed, 23 Jul 2008 02:27:59 +0200 X-Sieve: CMU Sieve 2.3 Received: from mail.mysql.com (mail.mysql.com [10.100.1.21]) by mailget.mysql.com (8.13.8/8.13.8) with ESMTP id m6N0Rxr8010224 for ; Wed, 23 Jul 2008 02:27:59 +0200 Received: from mailgate-b.mysql.com (mailgate-b.mysql.com [10.128.18.33]) by mail.mysql.com (8.13.3/8.13.3) with ESMTP id m6N0RxlS008035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Jul 2008 02:27:59 +0200 Received: from lists.mysql.com (lists.mysql.com [10.100.1.37]) by mailgate-b.mysql.com (8.13.8/8.13.8) with SMTP id m6N0Rwsk014359 for ; Wed, 23 Jul 2008 02:27:58 +0200 Received: (qmail 23771 invoked by uid 510); 23 Jul 2008 00:27:58 -0000 Mailing-List: contact commits-help@lists.mysql.com; run by ezmlm List-ID: Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Archive: http://lists.mysql.com/commits/50237 Delivered-To: mailing list commits@lists.mysql.com Received: (qmail 23746 invoked by uid 509); 23 Jul 2008 00:27:58 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: Marc Alff Subject: bzr commit into mysql-6.0-wl2110-review branch (marc.alff:2675) WL#2110 To: commits@lists.mysql.com User-Agent: Bazaar (1.4) X-CSetKey: marc.alff@sun.com-20080723002745-i3gy4xba08ijlvgs X-Worklog: 2110 X-bzr-action: commit X-bzr-revid: marc.alff@sun.com-20080723002745-i3gy4xba08ijlvgs X-bzr-revno: 2675 Message-Id: <20080723002751.9A6E42DCAB@lambda.WEBLAB> Date: Tue, 22 Jul 2008 18:27:51 -0600 (MDT) X-Cxn-Txn: 56108114,34985446 #At file:///home/malff/BZR-TREE/mysql-6.0-wl2110-review-part6/ 2675 Marc Alff 2008-07-22 WL#2110 (Stored Procedures: Implement SIGNAL) Formal review part 6/10: protocol This patch implements minor changes in the protocol layer. In particular, the SQLSTATE of a packet is not implied anymore by the error number, but provided by the caller. modified: libmysqld/lib_sql.cc sql/protocol.cc sql/protocol.h === modified file 'libmysqld/lib_sql.cc' --- a/libmysqld/lib_sql.cc 2008-06-20 11:40:01 +0000 +++ b/libmysqld/lib_sql.cc 2008-07-23 00:27:45 +0000 @@ -1069,14 +1069,15 @@ net_send_eof(THD *thd, uint server_statu } -void net_send_error_packet(THD *thd, uint sql_errno, const char *err) +void net_send_error_packet(THD *thd, uint sql_errno, const char *err, + const char* sqlstate) { MYSQL_DATA *data= thd->cur_data ? thd->cur_data : thd->alloc_new_dataset(); struct embedded_query_result *ei= data->embedded_info; ei->last_errno= sql_errno; strmake(ei->info, err, sizeof(ei->info)-1); - strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno)); + strmov(ei->sqlstate, sqlstate); ei->server_status= thd->server_status; thd->cur_data= 0; } === modified file 'sql/protocol.cc' --- a/sql/protocol.cc 2008-06-05 16:11:22 +0000 +++ b/sql/protocol.cc 2008-07-23 00:27:45 +0000 @@ -29,7 +29,8 @@ static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024; /* Declared non-static only because of the embedded library. */ -void net_send_error_packet(THD *thd, uint sql_errno, const char *err); +void net_send_error_packet(THD *thd, uint sql_errno, const char *err, + const char* sqlstate); void net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *); void net_send_eof(THD *thd, uint server_status, uint total_warn_count); #ifndef EMBEDDED_LIBRARY @@ -128,13 +129,14 @@ bool Protocol::net_store_data(const ucha critical that every error that can be intercepted is issued in one place only, my_message_sql. */ -void net_send_error(THD *thd, uint sql_errno, const char *err) +void net_send_error(THD *thd, uint sql_errno, const char *err, + const char* sqlstate) { DBUG_ENTER("net_send_error"); DBUG_ASSERT(!thd->spcont); DBUG_ASSERT(sql_errno); - DBUG_ASSERT(err && err[0]); + DBUG_ASSERT(err); DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, err)); @@ -147,7 +149,7 @@ void net_send_error(THD *thd, uint sql_e /* Abort multi-result sets */ thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS; - net_send_error_packet(thd, sql_errno, err); + net_send_error_packet(thd, sql_errno, err, sqlstate); thd->main_da.can_overwrite_status= FALSE; @@ -318,7 +320,8 @@ bool send_old_password_request(THD *thd) } -void net_send_error_packet(THD *thd, uint sql_errno, const char *err) +void net_send_error_packet(THD *thd, uint sql_errno, const char *err, + const char* sqlstate) { NET *net= &thd->net; uint length; @@ -345,7 +348,7 @@ void net_send_error_packet(THD *thd, uin { /* The first # is to make the protocol backward compatible */ buff[2]= '#'; - pos= (uchar*) strmov((char*) buff+3, mysql_errno_to_sqlstate(sql_errno)); + pos= (uchar*) strmov((char*) buff+3, sqlstate); } length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) - (char*) buff); @@ -445,7 +448,8 @@ void net_end_statement(THD *thd) /* The query failed, send error to log and abort bootstrap. */ net_send_error(thd, thd->main_da.sql_errno(), - thd->main_da.message()); + thd->main_da.message(), + thd->main_da.get_sqlstate()); break; case Diagnostics_area::DA_EOF: net_send_eof(thd, === modified file 'sql/protocol.h' --- a/sql/protocol.h 2008-02-11 16:11:22 +0000 +++ b/sql/protocol.h 2008-07-23 00:27:45 +0000 @@ -175,7 +175,8 @@ public: }; void send_warning(THD *thd, uint sql_errno, const char *err=0); -void net_send_error(THD *thd, uint sql_errno=0, const char *err=0); +void net_send_error(THD *thd, uint sql_errno, const char *err, + const char* sqlstate); void net_end_statement(THD *thd); bool send_old_password_request(THD *thd); uchar *net_store_data(uchar *to,const uchar *from, size_t length); -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=marc.alff@mysql.com