diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 4e2c6afda80..6bd8938fdca 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1850,29 +1850,33 @@ int ha_commit_or_rollback_by_xid(XID *xid, bool commit) #ifndef DBUG_OFF -/** - @note - This does not need to be multi-byte safe or anything -*/ -static char* xid_to_str(char *buf, XID *xid) +/** Converts XID to string. + +@param[out] buf output buffer +@param[in] xid XID to convert + +@return pointer to converted string + +@note This does not need to be multi-byte safe or anything */ +char *xid_to_str(char *buf, const XID &xid) { int i; char *s=buf; *s++='\''; - for (i=0; i < xid->gtrid_length+xid->bqual_length; i++) + for (i= 0; i < xid.gtrid_length + xid.bqual_length; i++) { - uchar c=(uchar)xid->data[i]; + uchar c= (uchar) xid.data[i]; /* is_next_dig is set if next character is a number */ bool is_next_dig= FALSE; if (i < XIDDATASIZE) { - char ch= xid->data[i+1]; + char ch= xid.data[i + 1]; is_next_dig= (ch >= '0' && ch <='9'); } - if (i == xid->gtrid_length) + if (i == xid.gtrid_length) { *s++='\''; - if (xid->bqual_length) + if (xid.bqual_length) { *s++='.'; *s++='\''; @@ -1994,7 +1998,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, { #ifndef DBUG_OFF char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("ignore xid %s", xid_to_str(buf, info->list+i))); + DBUG_PRINT("info", + ("ignore xid %s", xid_to_str(buf, info->list[i]))); #endif xid_cache_insert(info->list+i, XA_PREPARED); info->found_foreign_xids++; @@ -2024,7 +2029,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, if (rc == 0) { char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("commit xid %s", xid_to_str(buf, info->list+i))); + DBUG_PRINT("info", + ("commit xid %s", xid_to_str(buf, info->list[i]))); } #endif } @@ -2038,8 +2044,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, if (rc == 0) { char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("rollback xid %s", - xid_to_str(buf, info->list+i))); + DBUG_PRINT("info", + ("rollback xid %s", xid_to_str(buf, info->list[i]))); } #endif } |