mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Make memory allocation of VALBLK's more flexible (can be allocated
normally when too big to be suballocated) to handle big results. modified: storage/connect/valblk.cpp storage/connect/valblk.h - Add system variable connect_work_size giving the size of the CONNECT work area used for memory allocation. modified: storage/connect/ha_connect.cc storage/connect/plugutil.c storage/connect/user_connect.cc
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#define CheckParms(V, N) ChkIndx(N); ChkTyp(V);
|
||||
|
||||
extern "C" int trace;
|
||||
extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */
|
||||
|
||||
/***********************************************************************/
|
||||
/* AllocValBlock: allocate a VALBLK according to type. */
|
||||
@@ -105,8 +106,7 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len,
|
||||
return NULL;
|
||||
} // endswitch Type
|
||||
|
||||
blkp->Init(g, check);
|
||||
return blkp;
|
||||
return (blkp->Init(g, check)) ? NULL : blkp;
|
||||
} // end of AllocValBlock
|
||||
|
||||
/* -------------------------- Class VALBLK --------------------------- */
|
||||
@@ -116,6 +116,7 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len,
|
||||
/***********************************************************************/
|
||||
VALBLK::VALBLK(void *mp, int type, int nval, bool un)
|
||||
{
|
||||
Mblk = Nmblk;
|
||||
Blkp = mp;
|
||||
To_Nulls = NULL;
|
||||
Check = true;
|
||||
@@ -179,6 +180,22 @@ void VALBLK::SetNullable(bool b)
|
||||
|
||||
} // end of SetNullable
|
||||
|
||||
/***********************************************************************/
|
||||
/* Buffer allocation routine. */
|
||||
/***********************************************************************/
|
||||
bool VALBLK::AllocBuff(PGLOBAL g, size_t size)
|
||||
{
|
||||
Mblk.Size = size;
|
||||
|
||||
if (!(Blkp = PlgDBalloc(g, NULL, Mblk))) {
|
||||
sprintf(g->Message, MSG(MEM_ALLOC_ERR), "Blkp", Mblk.Size);
|
||||
fprintf(stderr, "%s\n", g->Message);
|
||||
return true;
|
||||
} // endif Blkp
|
||||
|
||||
return false;
|
||||
} // end of AllocBuff
|
||||
|
||||
/***********************************************************************/
|
||||
/* Check functions. */
|
||||
/***********************************************************************/
|
||||
@@ -229,13 +246,15 @@ TYPBLK<TYPE>::TYPBLK(void *mp, int nval, int type, int prec, bool un)
|
||||
/* Initialization routine. */
|
||||
/***********************************************************************/
|
||||
template <class TYPE>
|
||||
void TYPBLK<TYPE>::Init(PGLOBAL g, bool check)
|
||||
bool TYPBLK<TYPE>::Init(PGLOBAL g, bool check)
|
||||
{
|
||||
if (!Blkp)
|
||||
Blkp = PlugSubAlloc(g, NULL, Nval * sizeof(TYPE));
|
||||
if (AllocBuff(g, Nval * sizeof(TYPE)))
|
||||
return true;
|
||||
|
||||
Check = check;
|
||||
Global = g;
|
||||
return false;
|
||||
} // end of Init
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -576,16 +595,18 @@ CHRBLK::CHRBLK(void *mp, int nval, int len, int prec, bool blank)
|
||||
/***********************************************************************/
|
||||
/* Initialization routine. */
|
||||
/***********************************************************************/
|
||||
void CHRBLK::Init(PGLOBAL g, bool check)
|
||||
bool CHRBLK::Init(PGLOBAL g, bool check)
|
||||
{
|
||||
Valp = (char*)PlugSubAlloc(g, NULL, Long + 1);
|
||||
Valp[Long] = '\0';
|
||||
|
||||
if (!Blkp)
|
||||
Blkp = PlugSubAlloc(g, NULL, Nval * Long);
|
||||
if (AllocBuff(g, Nval * Long))
|
||||
return true;
|
||||
|
||||
Check = check;
|
||||
Global = g;
|
||||
return false;
|
||||
} // end of Init
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -936,13 +957,15 @@ STRBLK::STRBLK(PGLOBAL g, void *mp, int nval)
|
||||
/***********************************************************************/
|
||||
/* Initialization routine. */
|
||||
/***********************************************************************/
|
||||
void STRBLK::Init(PGLOBAL g, bool check)
|
||||
bool STRBLK::Init(PGLOBAL g, bool check)
|
||||
{
|
||||
if (!Blkp)
|
||||
Blkp = PlugSubAlloc(g, NULL, Nval * sizeof(PSZ));
|
||||
if (AllocBuff(g, Nval * sizeof(PSZ)))
|
||||
return true;
|
||||
|
||||
Check = check;
|
||||
Global = g;
|
||||
return false;
|
||||
} // end of Init
|
||||
|
||||
/***********************************************************************/
|
||||
|
Reference in New Issue
Block a user