Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Do
-
None
Description
We do see the following anywhere in the Spider codebase.
if (str->reserve(SPIDER_SQL_WHERE_LEN)) |
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
|
This is messy and makes the code less readable. It would be better if we could write like this:
if (int err = str->append(SPIDER_SQL_WHERE_STR)) |
DBUG_RETURN(err);
|
 |
// multiple string can be appended at once
|
if (int err = str->append(SPIDER_SQL_IN_STR, SPIDER_SQL_OPEN_PAREN_STR)) |
DBUG_RETURN(err);
|
The memory allocation should be automatically done in the append function. This automatic memory allocation should care about the performance. Possibly, it would allocate extra memory and reallocate memory only when it is necessary.
Attachments
Issue Links
- relates to
-
MDEV-27684 Spider: remove pattern str->reserve() then str->q_append()
- Stalled