Skip to content

Commit 7c4d3fe

Browse files
committed
ecpg: Refactor ecpg_log() to skip unnecessary calls to ECPGget_sqlca().
Previously, ecpg_log() always called ECPGget_sqlca() to retrieve sqlca, even though it was only needed for debug logging. This commit updates ecpg_log() to call ECPGget_sqlca() only when debug logging is enabled. Author: Yuto Sasaki Reviewed-by: Alvaro Herrera, Tom Lane, Fujii Masao Discussion: https://postgr.es/m/TY2PR01MB3628A85689649BABC9A1C6C3C1782@TY2PR01MB3628.jpnprd01.prod.outlook.com
1 parent 53af949 commit 7c4d3fe

File tree

1 file changed

+3
-1
lines changed
  • src/interfaces/ecpg/ecpglib

1 file changed

+3
-1
lines changed

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ void
232232
ecpg_log(const char *format,...)
233233
{
234234
va_list ap;
235-
struct sqlca_t *sqlca = ECPGget_sqlca();
236235
const char *intl_format;
237236
int bufsize;
238237
char *fmt;
238+
struct sqlca_t *sqlca;
239239

240240
/*
241241
* For performance reasons, inspect simple_debug without taking the mutex.
@@ -262,6 +262,8 @@ ecpg_log(const char *format,...)
262262
else
263263
snprintf(fmt, bufsize, "[%d]: %s", (int) getpid(), intl_format);
264264

265+
sqlca = ECPGget_sqlca();
266+
265267
pthread_mutex_lock(&debug_mutex);
266268

267269
/* Now that we hold the mutex, recheck simple_debug */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy