mirror of
https://github.com/MariaDB/server.git
synced 2025-12-07 17:42:39 +03:00
commit git 167, 168 and 169 msg
This commit is contained in:
@@ -4062,7 +4062,12 @@ int ha_connect::info(uint flag)
|
|||||||
|
|
||||||
DBUG_ENTER("ha_connect::info");
|
DBUG_ENTER("ha_connect::info");
|
||||||
|
|
||||||
if (trace)
|
if (!g) {
|
||||||
|
my_message(ER_UNKNOWN_ERROR, "Cannot get g pointer", MYF(0));
|
||||||
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
|
} // endif g
|
||||||
|
|
||||||
|
if (trace)
|
||||||
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
||||||
|
|
||||||
// tdbp must be available to get updated info
|
// tdbp must be available to get updated info
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -10,4 +10,4 @@ let $SECUREDIR= `select @@secure_file_priv`;
|
|||||||
INSERT INTO t1 VALUES (10);
|
INSERT INTO t1 VALUES (10);
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
--remove_file $SECUREDIR/t1.dbf
|
--remove_file $MYSQL_TMP_DIR/t1.dbf
|
||||||
|
|||||||
@@ -1646,7 +1646,7 @@ int TDBDOS::TestBlock(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
||||||
{
|
{
|
||||||
int k, n;
|
int k, n, rc = RC_OK;
|
||||||
bool fixed, doit, sep, b = (pxdf != NULL);
|
bool fixed, doit, sep, b = (pxdf != NULL);
|
||||||
PCOL *keycols, colp;
|
PCOL *keycols, colp;
|
||||||
PIXDEF xdp, sxp = NULL;
|
PIXDEF xdp, sxp = NULL;
|
||||||
@@ -1691,95 +1691,105 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
|||||||
} else if (!(pxdf = dfp->GetIndx()))
|
} else if (!(pxdf = dfp->GetIndx()))
|
||||||
return RC_INFO; // No index to make
|
return RC_INFO; // No index to make
|
||||||
|
|
||||||
// Allocate all columns that will be used by indexes.
|
try {
|
||||||
// This must be done before opening the table so specific
|
// Allocate all columns that will be used by indexes.
|
||||||
// column initialization can be done (in particular by TDBVCT)
|
// This must be done before opening the table so specific
|
||||||
for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
|
// column initialization can be done (in particular by TDBVCT)
|
||||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||||
if (!(colp = ColDB(g, kdp->GetName(), 0))) {
|
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||||
sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
|
if (!(colp = ColDB(g, kdp->GetName(), 0))) {
|
||||||
goto err;
|
sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
|
||||||
} else if (colp->GetResultType() == TYPE_DECIM) {
|
goto err;
|
||||||
sprintf(g->Message, "Decimal columns are not indexable yet");
|
} else if (colp->GetResultType() == TYPE_DECIM) {
|
||||||
goto err;
|
sprintf(g->Message, "Decimal columns are not indexable yet");
|
||||||
} // endif Type
|
goto err;
|
||||||
|
} // endif Type
|
||||||
|
|
||||||
colp->InitValue(g);
|
colp->InitValue(g);
|
||||||
n = MY_MAX(n, xdp->GetNparts());
|
n = MY_MAX(n, xdp->GetNparts());
|
||||||
} // endfor kdp
|
} // endfor kdp
|
||||||
|
|
||||||
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
|
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
|
||||||
sep = dfp->GetBoolCatInfo("SepIndex", false);
|
sep = dfp->GetBoolCatInfo("SepIndex", false);
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Construct and save the defined indexes. */
|
/* Construct and save the defined indexes. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
for (xdp = pxdf; xdp; xdp = xdp->GetNext())
|
for (xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||||
if (!OpenDB(g)) {
|
if (!OpenDB(g)) {
|
||||||
if (xdp->IsAuto() && fixed)
|
if (xdp->IsAuto() && fixed)
|
||||||
// Auto increment key and fixed file: use an XXROW index
|
// Auto increment key and fixed file: use an XXROW index
|
||||||
continue; // XXROW index doesn't need to be made
|
continue; // XXROW index doesn't need to be made
|
||||||
|
|
||||||
// On Update, redo only indexes that are modified
|
// On Update, redo only indexes that are modified
|
||||||
doit = !To_SetCols;
|
doit = !To_SetCols;
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
if (sxp)
|
if (sxp)
|
||||||
xdp->SetID(sxp->GetID() + 1);
|
xdp->SetID(sxp->GetID() + 1);
|
||||||
|
|
||||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||||
// Check whether this column was updated
|
// Check whether this column was updated
|
||||||
for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
|
for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
|
||||||
if (!stricmp(kdp->GetName(), colp->GetName()))
|
if (!stricmp(kdp->GetName(), colp->GetName()))
|
||||||
doit = true;
|
doit = true;
|
||||||
|
|
||||||
keycols[n++] = ColDB(g, kdp->GetName(), 0);
|
keycols[n++] = ColDB(g, kdp->GetName(), 0);
|
||||||
} // endfor kdp
|
} // endfor kdp
|
||||||
|
|
||||||
// If no indexed columns were updated, don't remake the index
|
// If no indexed columns were updated, don't remake the index
|
||||||
// if indexes are in separate files.
|
// if indexes are in separate files.
|
||||||
if (!doit && sep)
|
if (!doit && sep)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = xdp->GetNparts();
|
k = xdp->GetNparts();
|
||||||
|
|
||||||
// Make the index and save it
|
// Make the index and save it
|
||||||
if (dfp->Huge)
|
if (dfp->Huge)
|
||||||
pxp = new(g) XHUGE;
|
pxp = new(g) XHUGE;
|
||||||
else
|
else
|
||||||
pxp = new(g) XFILE;
|
pxp = new(g) XFILE;
|
||||||
|
|
||||||
if (k == 1) // Simple index
|
if (k == 1) // Simple index
|
||||||
x = new(g) XINDXS(this, xdp, pxp, keycols);
|
x = new(g) XINDXS(this, xdp, pxp, keycols);
|
||||||
else // Multi-Column index
|
else // Multi-Column index
|
||||||
x = new(g) XINDEX(this, xdp, pxp, keycols);
|
x = new(g) XINDEX(this, xdp, pxp, keycols);
|
||||||
|
|
||||||
if (!x->Make(g, sxp)) {
|
if (!x->Make(g, sxp)) {
|
||||||
// Retreive define values from the index
|
// Retreive define values from the index
|
||||||
xdp->SetMaxSame(x->GetMaxSame());
|
xdp->SetMaxSame(x->GetMaxSame());
|
||||||
// xdp->SetSize(x->GetSize());
|
// xdp->SetSize(x->GetSize());
|
||||||
|
|
||||||
// store KXYCOL Mxs in KPARTDEF Mxsame
|
// store KXYCOL Mxs in KPARTDEF Mxsame
|
||||||
xdp->SetMxsame(x);
|
xdp->SetMxsame(x);
|
||||||
|
|
||||||
#if defined(TRACE)
|
#if defined(TRACE)
|
||||||
printf("Make done...\n");
|
printf("Make done...\n");
|
||||||
#endif // TRACE
|
#endif // TRACE
|
||||||
|
|
||||||
// if (x->GetSize() > 0)
|
// if (x->GetSize() > 0)
|
||||||
sxp = xdp;
|
sxp = xdp;
|
||||||
|
|
||||||
xdp->SetInvalid(false);
|
xdp->SetInvalid(false);
|
||||||
} else
|
} else
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return RC_INFO; // Error or Physical table does not exist
|
return RC_INFO; // Error or Physical table does not exist
|
||||||
|
|
||||||
if (Use == USE_OPEN)
|
} catch (int n) {
|
||||||
|
if (trace)
|
||||||
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
|
rc = RC_FX;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = RC_FX;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
|
if (Use == USE_OPEN)
|
||||||
CloseDB(g);
|
CloseDB(g);
|
||||||
|
|
||||||
return RC_OK;
|
return rc;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (sxp)
|
if (sxp)
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
|
|||||||
if (ApplyFilter(g, filp))
|
if (ApplyFilter(g, filp))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// passthru
|
// fall through
|
||||||
case RC_NF:
|
case RC_NF:
|
||||||
continue;
|
continue;
|
||||||
case RC_EF:
|
case RC_EF:
|
||||||
@@ -3008,7 +3008,8 @@ KXYCOL::KXYCOL(PKXBASE kp) : To_Keys(Keys.Memp),
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
||||||
{
|
{
|
||||||
int len = colp->GetLength(), prec = colp->GetScale();
|
int len = colp->GetLength(), prec = colp->GetScale();
|
||||||
|
bool un = colp->IsUnsigned();
|
||||||
|
|
||||||
// Currently no indexing on NULL columns
|
// Currently no indexing on NULL columns
|
||||||
if (colp->IsNullable() && kln) {
|
if (colp->IsNullable() && kln) {
|
||||||
@@ -3028,7 +3029,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
|||||||
// Allocate the Value object used when moving items
|
// Allocate the Value object used when moving items
|
||||||
Type = colp->GetResultType();
|
Type = colp->GetResultType();
|
||||||
|
|
||||||
if (!(Valp = AllocateValue(g, Type, len, prec, colp->IsUnsigned())))
|
if (!(Valp = AllocateValue(g, Type, len, prec, un)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Klen = Valp->GetClen();
|
Klen = Valp->GetClen();
|
||||||
@@ -3044,7 +3045,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
|||||||
// Currently we set it to true to be compatible with QRY blocks,
|
// Currently we set it to true to be compatible with QRY blocks,
|
||||||
// and the one before last is to enable length/type checking, set to
|
// and the one before last is to enable length/type checking, set to
|
||||||
// true if not a prefix key.
|
// true if not a prefix key.
|
||||||
Kblp = AllocValBlock(g, To_Keys, Type, n, len, prec, !Prefix, true);
|
Kblp = AllocValBlock(g, To_Keys, Type, n, len, prec, !Prefix, true, un);
|
||||||
Asc = sm; // Sort mode: Asc=true Desc=false
|
Asc = sm; // Sort mode: Asc=true Desc=false
|
||||||
Ndf = n;
|
Ndf = n;
|
||||||
|
|
||||||
@@ -3064,7 +3065,8 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
||||||
{
|
{
|
||||||
int len = colp->GetLength(), prec = colp->GetScale();
|
int len = colp->GetLength(), prec = colp->GetScale();
|
||||||
|
bool un = colp->IsUnsigned();
|
||||||
|
|
||||||
if (n[3] && colp->GetLength() > n[3]
|
if (n[3] && colp->GetLength() > n[3]
|
||||||
&& colp->GetResultType() == TYPE_STRING) {
|
&& colp->GetResultType() == TYPE_STRING) {
|
||||||
@@ -3079,7 +3081,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
|||||||
this, colp, Type, n[0], len, m);
|
this, colp, Type, n[0], len, m);
|
||||||
|
|
||||||
// Allocate the Value object used when moving items
|
// Allocate the Value object used when moving items
|
||||||
Valp = AllocateValue(g, Type, len, prec, colp->IsUnsigned());
|
Valp = AllocateValue(g, Type, len, prec, un);
|
||||||
Klen = Valp->GetClen();
|
Klen = Valp->GetClen();
|
||||||
|
|
||||||
if (n[2]) {
|
if (n[2]) {
|
||||||
@@ -3088,7 +3090,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
|||||||
Bkeys.Sub = true;
|
Bkeys.Sub = true;
|
||||||
|
|
||||||
// Allocate the Valblk containing initial block key values
|
// Allocate the Valblk containing initial block key values
|
||||||
Blkp = AllocValBlock(g, To_Bkeys, Type, n[2], len, prec, true, true);
|
Blkp = AllocValBlock(g, To_Bkeys, Type, n[2], len, prec, true, true, un);
|
||||||
} // endif nb
|
} // endif nb
|
||||||
|
|
||||||
Keys.Size = n[0] * Klen;
|
Keys.Size = n[0] * Klen;
|
||||||
@@ -3099,7 +3101,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
|||||||
// by blanks (if true) or keep the zero ending char (if false).
|
// by blanks (if true) or keep the zero ending char (if false).
|
||||||
// Currently we set it to true to be compatible with QRY blocks,
|
// Currently we set it to true to be compatible with QRY blocks,
|
||||||
// and last one to enable type checking (no conversion).
|
// and last one to enable type checking (no conversion).
|
||||||
Kblp = AllocValBlock(g, To_Keys, Type, n[0], len, prec, !Prefix, true);
|
Kblp = AllocValBlock(g, To_Keys, Type, n[0], len, prec, !Prefix, true, un);
|
||||||
|
|
||||||
if (n[1]) {
|
if (n[1]) {
|
||||||
Koff.Size = n[1] * sizeof(int);
|
Koff.Size = n[1] * sizeof(int);
|
||||||
|
|||||||
Reference in New Issue
Block a user