mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-04 00:02:52 -05:00 
			
		
		
		
	Add optional on/off argument to \timing.
David Fetter.
This commit is contained in:
		
							parent
							
								
									96675bff1f
								
							
						
					
					
						commit
						8b64a2642a
					
				@ -1,5 +1,5 @@
 | 
			
		||||
<!--
 | 
			
		||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.207 2008/06/01 16:23:08 tgl Exp $
 | 
			
		||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.208 2008/06/11 10:48:16 heikki Exp $
 | 
			
		||||
PostgreSQL documentation
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
@ -1861,10 +1861,11 @@ lo_import 152801
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      <varlistentry>
 | 
			
		||||
       <term><literal>\timing</literal></term>
 | 
			
		||||
       <term><literal>\timing [ <replaceable class="parameter">on</replaceable> | <replaceable class="parameter">off</replaceable> ]</literal></term>
 | 
			
		||||
        <listitem>
 | 
			
		||||
        <para>
 | 
			
		||||
         Toggles a display of how long each SQL statement takes, in milliseconds.
 | 
			
		||||
         Without parameter, toggles a display of how long each SQL statement
 | 
			
		||||
         takes, in milliseconds.  With parameter, sets same.
 | 
			
		||||
        </para>
 | 
			
		||||
       </listitem>
 | 
			
		||||
      </varlistentry>
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2000-2008, PostgreSQL Global Development Group
 | 
			
		||||
 *
 | 
			
		||||
 * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.189 2008/05/14 19:10:29 tgl Exp $
 | 
			
		||||
 * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.190 2008/06/11 10:48:17 heikki Exp $
 | 
			
		||||
 */
 | 
			
		||||
#include "postgres_fe.h"
 | 
			
		||||
#include "command.h"
 | 
			
		||||
@ -884,7 +884,12 @@ exec_command(const char *cmd,
 | 
			
		||||
	/* \timing -- toggle timing of queries */
 | 
			
		||||
	else if (strcmp(cmd, "timing") == 0)
 | 
			
		||||
	{
 | 
			
		||||
		pset.timing = !pset.timing;
 | 
			
		||||
		char	   *opt = psql_scan_slash_option(scan_state,
 | 
			
		||||
											     OT_NORMAL, NULL, false);
 | 
			
		||||
		if (opt)
 | 
			
		||||
			pset.timing = ParseVariableBool(opt);
 | 
			
		||||
		else
 | 
			
		||||
			pset.timing = !pset.timing;
 | 
			
		||||
		if (!pset.quiet)
 | 
			
		||||
		{
 | 
			
		||||
			if (pset.timing)
 | 
			
		||||
@ -892,6 +897,7 @@ exec_command(const char *cmd,
 | 
			
		||||
			else
 | 
			
		||||
				puts(_("Timing is off."));
 | 
			
		||||
		}
 | 
			
		||||
		free(opt);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* \unset */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user