Hi,
> OK, patch 0002 implements this idea with minimal changes to the existing logic.
Here is a slightly modified version:
``
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -570,7 +570,7 @@ AddStmtToCache(int lineno, /* line # of
statement */
entry = &stmtCacheEntries[entNo];
entry->lineno = lineno;
entry->ecpgQuery = ecpg_strdup(ecpgQuery, lineno, &alloc_failed);
- if (!entry->ecpgQuery)
+ if (alloc_failed)
return -1;
entry->connection = connection;
entry->execs = 0;
```
We know that ecpgQuery can't be NULL because we hash its value above.
Thus ecpg_strdup can fail only if strdup() fails.