Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] [PATCH] MySQL cosmetic change

From: Martin Warnes <martin@xxxxxxxxxxxxxxxxx>
Date: Sun, 10 Jun 2007 19:23:38 +0100
Attached is a small patch that adds a preference option to allow the SQL Query string to be appended to the INFO column display. This makes life a little bit easier when scanning a trace to find the packet associated with a specific query. I thought it was better to implement it as a preference option with default set FALSE as it can clutter up the display for applications that generate large amounts of queries.

Regards .. Martin
Index: packet-mysql.c
===================================================================
--- packet-mysql.c	(revision 22068)
+++ packet-mysql.c	(working copy)
@@ -327,6 +327,7 @@
 
 /* dissector configuration */
 static gboolean mysql_desegment = TRUE;
+static gboolean mysql_showquery = FALSE;
 
 /* expand-the-tree flags */
 static gint ett_mysql = -1;
@@ -901,6 +902,10 @@
 				       "Whether the MySQL dissector should reassemble MySQL buffers spanning multiple TCP segments."
 				       " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
 				       &mysql_desegment);
+        prefs_register_bool_preference(mysql_module, "show_sql_query",
+                                       "Show SQL Query string in INFO column",
+                                       "Whether the MySQL dissector should display the SQL query string in the INFO column.",
+                                       &mysql_showquery);
 			       
 	register_dissector("mysql", dissect_mysql_pdu, proto_mysql);				       
 }
@@ -1315,6 +1320,10 @@
 			proto_tree_add_item(req_tree, hf_mysql_query, tvb,
 					    offset, strlen, FALSE);
 		}
+		if (mysql_showquery) {
+		        if (check_col(pinfo->cinfo, COL_INFO))
+		                col_append_fstr(pinfo->cinfo, COL_INFO, " { %s } ",tvb_get_string(tvb, offset, strlen));
+		}
 		offset+= strlen;
 		conn_data->state= RESPONSE_TABULAR;
 		break;