Bug 963554 - Defining MOZ_STORAGE_SORTWARNING_SQL_DUMP prints the SQL command that invoked sorting in the log. r=mak
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Mon, 28 Apr 2014 20:15:00 -0400
changeset 181223 5ed3fa857eac2be14e6162d74a0fee79e4939be7
parent 181222 948ac73a8cc012639464690b35db5b56c29d5f5a
child 181224 c4cdaf3bd2d431e475659bfd4490e518a9501aff
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmak
bugs963554
milestone32.0a1
Bug 963554 - Defining MOZ_STORAGE_SORTWARNING_SQL_DUMP prints the SQL command that invoked sorting in the log. r=mak The default short warning et al is not *THAT* useful even if one may be able to dump the original SQL command using environment variable for later correlation. Defining MOZ_STORAGE_SORTWARNING_SQL_DUMP will enable the printout of SQL command directly in the log .
storage/src/mozStoragePrivateHelpers.cpp
--- a/storage/src/mozStoragePrivateHelpers.cpp
+++ b/storage/src/mozStoragePrivateHelpers.cpp
@@ -97,18 +97,23 @@ checkAndLogStatementPerformance(sqlite3_
 
   nsAutoCString message;
   message.AppendInt(count);
   if (count == 1)
     message.Append(" sort operation has ");
   else
     message.Append(" sort operations have ");
   message.Append("occurred for the SQL statement '");
+#ifdef MOZ_STORAGE_SORTWARNING_SQL_DUMP
+  message.Append("SQL command: ");
+  message.Append(sql);
+#else
   nsPrintfCString address("0x%p", aStatement);
   message.Append(address);
+#endif
   message.Append("'.  See https://developer.mozilla.org/En/Storage/Warnings "
                  "details.");
   NS_WARNING(message.get());
 }
 
 nsIVariant *
 convertJSValToVariant(
   JSContext *aCtx,