@@ -594,6 +594,7 @@ PSQLexec(const char *query)
594
594
int
595
595
PSQLexecWatch (const char * query , const printQueryOpt * opt , FILE * printQueryFout )
596
596
{
597
+ bool timing = pset .timing ;
597
598
PGresult * res ;
598
599
double elapsed_msec = 0 ;
599
600
instr_time before ;
@@ -608,7 +609,7 @@ PSQLexecWatch(const char *query, const printQueryOpt *opt, FILE *printQueryFout)
608
609
609
610
SetCancelConn (pset .db );
610
611
611
- if (pset . timing )
612
+ if (timing )
612
613
INSTR_TIME_SET_CURRENT (before );
613
614
614
615
res = PQexec (pset .db , query );
@@ -621,7 +622,7 @@ PSQLexecWatch(const char *query, const printQueryOpt *opt, FILE *printQueryFout)
621
622
return 0 ;
622
623
}
623
624
624
- if (pset . timing )
625
+ if (timing )
625
626
{
626
627
INSTR_TIME_SET_CURRENT (after );
627
628
INSTR_TIME_SUBTRACT (after , before );
@@ -674,7 +675,7 @@ PSQLexecWatch(const char *query, const printQueryOpt *opt, FILE *printQueryFout)
674
675
fflush (fout );
675
676
676
677
/* Possible microtiming output */
677
- if (pset . timing )
678
+ if (timing )
678
679
PrintTiming (elapsed_msec );
679
680
680
681
return 1 ;
@@ -1192,6 +1193,7 @@ PrintQueryResults(PGresult *results)
1192
1193
bool
1193
1194
SendQuery (const char * query )
1194
1195
{
1196
+ bool timing = pset .timing ;
1195
1197
PGresult * results ;
1196
1198
PGTransactionStatusType transaction_status ;
1197
1199
double elapsed_msec = 0 ;
@@ -1300,7 +1302,7 @@ SendQuery(const char *query)
1300
1302
instr_time before ,
1301
1303
after ;
1302
1304
1303
- if (pset . timing )
1305
+ if (timing )
1304
1306
INSTR_TIME_SET_CURRENT (before );
1305
1307
1306
1308
results = PQexec (pset .db , query );
@@ -1309,7 +1311,7 @@ SendQuery(const char *query)
1309
1311
ResetCancelConn ();
1310
1312
OK = ProcessResult (& results );
1311
1313
1312
- if (pset . timing )
1314
+ if (timing )
1313
1315
{
1314
1316
INSTR_TIME_SET_CURRENT (after );
1315
1317
INSTR_TIME_SUBTRACT (after , before );
@@ -1400,7 +1402,7 @@ SendQuery(const char *query)
1400
1402
ClearOrSaveResult (results );
1401
1403
1402
1404
/* Possible microtiming output */
1403
- if (pset . timing )
1405
+ if (timing )
1404
1406
PrintTiming (elapsed_msec );
1405
1407
1406
1408
/* check for events that may occur during query execution */
@@ -1471,14 +1473,15 @@ SendQuery(const char *query)
1471
1473
static bool
1472
1474
DescribeQuery (const char * query , double * elapsed_msec )
1473
1475
{
1476
+ bool timing = pset .timing ;
1474
1477
PGresult * results ;
1475
1478
bool OK ;
1476
1479
instr_time before ,
1477
1480
after ;
1478
1481
1479
1482
* elapsed_msec = 0 ;
1480
1483
1481
- if (pset . timing )
1484
+ if (timing )
1482
1485
INSTR_TIME_SET_CURRENT (before );
1483
1486
1484
1487
/*
@@ -1550,7 +1553,7 @@ DescribeQuery(const char *query, double *elapsed_msec)
1550
1553
results = PQexec (pset .db , buf .data );
1551
1554
OK = AcceptResult (results );
1552
1555
1553
- if (pset . timing )
1556
+ if (timing )
1554
1557
{
1555
1558
INSTR_TIME_SET_CURRENT (after );
1556
1559
INSTR_TIME_SUBTRACT (after , before );
@@ -1591,6 +1594,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1591
1594
PGresult * results ;
1592
1595
PQExpBufferData buf ;
1593
1596
printQueryOpt my_popt = pset .popt ;
1597
+ bool timing = pset .timing ;
1594
1598
FILE * fout ;
1595
1599
bool is_pipe ;
1596
1600
bool is_pager = false;
@@ -1610,7 +1614,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1610
1614
my_popt .topt .stop_table = false;
1611
1615
my_popt .topt .prior_records = 0 ;
1612
1616
1613
- if (pset . timing )
1617
+ if (timing )
1614
1618
INSTR_TIME_SET_CURRENT (before );
1615
1619
1616
1620
/* if we're not in a transaction, start one */
@@ -1640,7 +1644,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1640
1644
if (!OK )
1641
1645
goto cleanup ;
1642
1646
1643
- if (pset . timing )
1647
+ if (timing )
1644
1648
{
1645
1649
INSTR_TIME_SET_CURRENT (after );
1646
1650
INSTR_TIME_SUBTRACT (after , before );
@@ -1682,13 +1686,13 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1682
1686
1683
1687
for (;;)
1684
1688
{
1685
- if (pset . timing )
1689
+ if (timing )
1686
1690
INSTR_TIME_SET_CURRENT (before );
1687
1691
1688
1692
/* get fetch_count tuples at a time */
1689
1693
results = PQexec (pset .db , fetch_cmd );
1690
1694
1691
- if (pset . timing )
1695
+ if (timing )
1692
1696
{
1693
1697
INSTR_TIME_SET_CURRENT (after );
1694
1698
INSTR_TIME_SUBTRACT (after , before );
@@ -1802,7 +1806,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1802
1806
}
1803
1807
1804
1808
cleanup :
1805
- if (pset . timing )
1809
+ if (timing )
1806
1810
INSTR_TIME_SET_CURRENT (before );
1807
1811
1808
1812
/*
@@ -1828,7 +1832,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
1828
1832
ClearOrSaveResult (results );
1829
1833
}
1830
1834
1831
- if (pset . timing )
1835
+ if (timing )
1832
1836
{
1833
1837
INSTR_TIME_SET_CURRENT (after );
1834
1838
INSTR_TIME_SUBTRACT (after , before );
0 commit comments