mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +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");
|
||||
|
||||
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);
|
||||
|
||||
// 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);
|
||||
SELECT * FROM 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 k, n;
|
||||
int k, n, rc = RC_OK;
|
||||
bool fixed, doit, sep, b = (pxdf != NULL);
|
||||
PCOL *keycols, colp;
|
||||
PIXDEF xdp, sxp = NULL;
|
||||
@@ -1691,95 +1691,105 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
||||
} else if (!(pxdf = dfp->GetIndx()))
|
||||
return RC_INFO; // No index to make
|
||||
|
||||
// Allocate all columns that will be used by indexes.
|
||||
// This must be done before opening the table so specific
|
||||
// column initialization can be done (in particular by TDBVCT)
|
||||
for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||
if (!(colp = ColDB(g, kdp->GetName(), 0))) {
|
||||
sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
|
||||
goto err;
|
||||
} else if (colp->GetResultType() == TYPE_DECIM) {
|
||||
sprintf(g->Message, "Decimal columns are not indexable yet");
|
||||
goto err;
|
||||
} // endif Type
|
||||
try {
|
||||
// Allocate all columns that will be used by indexes.
|
||||
// This must be done before opening the table so specific
|
||||
// column initialization can be done (in particular by TDBVCT)
|
||||
for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||
if (!(colp = ColDB(g, kdp->GetName(), 0))) {
|
||||
sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
|
||||
goto err;
|
||||
} else if (colp->GetResultType() == TYPE_DECIM) {
|
||||
sprintf(g->Message, "Decimal columns are not indexable yet");
|
||||
goto err;
|
||||
} // endif Type
|
||||
|
||||
colp->InitValue(g);
|
||||
n = MY_MAX(n, xdp->GetNparts());
|
||||
} // endfor kdp
|
||||
colp->InitValue(g);
|
||||
n = MY_MAX(n, xdp->GetNparts());
|
||||
} // endfor kdp
|
||||
|
||||
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
|
||||
sep = dfp->GetBoolCatInfo("SepIndex", false);
|
||||
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
|
||||
sep = dfp->GetBoolCatInfo("SepIndex", false);
|
||||
|
||||
/*********************************************************************/
|
||||
/* Construct and save the defined indexes. */
|
||||
/*********************************************************************/
|
||||
for (xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||
if (!OpenDB(g)) {
|
||||
if (xdp->IsAuto() && fixed)
|
||||
// Auto increment key and fixed file: use an XXROW index
|
||||
continue; // XXROW index doesn't need to be made
|
||||
/*********************************************************************/
|
||||
/* Construct and save the defined indexes. */
|
||||
/*********************************************************************/
|
||||
for (xdp = pxdf; xdp; xdp = xdp->GetNext())
|
||||
if (!OpenDB(g)) {
|
||||
if (xdp->IsAuto() && fixed)
|
||||
// Auto increment key and fixed file: use an XXROW index
|
||||
continue; // XXROW index doesn't need to be made
|
||||
|
||||
// On Update, redo only indexes that are modified
|
||||
doit = !To_SetCols;
|
||||
n = 0;
|
||||
// On Update, redo only indexes that are modified
|
||||
doit = !To_SetCols;
|
||||
n = 0;
|
||||
|
||||
if (sxp)
|
||||
xdp->SetID(sxp->GetID() + 1);
|
||||
if (sxp)
|
||||
xdp->SetID(sxp->GetID() + 1);
|
||||
|
||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||
// Check whether this column was updated
|
||||
for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
|
||||
if (!stricmp(kdp->GetName(), colp->GetName()))
|
||||
doit = true;
|
||||
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
|
||||
// Check whether this column was updated
|
||||
for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
|
||||
if (!stricmp(kdp->GetName(), colp->GetName()))
|
||||
doit = true;
|
||||
|
||||
keycols[n++] = ColDB(g, kdp->GetName(), 0);
|
||||
} // endfor kdp
|
||||
keycols[n++] = ColDB(g, kdp->GetName(), 0);
|
||||
} // endfor kdp
|
||||
|
||||
// If no indexed columns were updated, don't remake the index
|
||||
// if indexes are in separate files.
|
||||
if (!doit && sep)
|
||||
continue;
|
||||
// If no indexed columns were updated, don't remake the index
|
||||
// if indexes are in separate files.
|
||||
if (!doit && sep)
|
||||
continue;
|
||||
|
||||
k = xdp->GetNparts();
|
||||
k = xdp->GetNparts();
|
||||
|
||||
// Make the index and save it
|
||||
if (dfp->Huge)
|
||||
pxp = new(g) XHUGE;
|
||||
else
|
||||
pxp = new(g) XFILE;
|
||||
// Make the index and save it
|
||||
if (dfp->Huge)
|
||||
pxp = new(g) XHUGE;
|
||||
else
|
||||
pxp = new(g) XFILE;
|
||||
|
||||
if (k == 1) // Simple index
|
||||
x = new(g) XINDXS(this, xdp, pxp, keycols);
|
||||
else // Multi-Column index
|
||||
x = new(g) XINDEX(this, xdp, pxp, keycols);
|
||||
if (k == 1) // Simple index
|
||||
x = new(g) XINDXS(this, xdp, pxp, keycols);
|
||||
else // Multi-Column index
|
||||
x = new(g) XINDEX(this, xdp, pxp, keycols);
|
||||
|
||||
if (!x->Make(g, sxp)) {
|
||||
// Retreive define values from the index
|
||||
xdp->SetMaxSame(x->GetMaxSame());
|
||||
// xdp->SetSize(x->GetSize());
|
||||
if (!x->Make(g, sxp)) {
|
||||
// Retreive define values from the index
|
||||
xdp->SetMaxSame(x->GetMaxSame());
|
||||
// xdp->SetSize(x->GetSize());
|
||||
|
||||
// store KXYCOL Mxs in KPARTDEF Mxsame
|
||||
xdp->SetMxsame(x);
|
||||
// store KXYCOL Mxs in KPARTDEF Mxsame
|
||||
xdp->SetMxsame(x);
|
||||
|
||||
#if defined(TRACE)
|
||||
printf("Make done...\n");
|
||||
printf("Make done...\n");
|
||||
#endif // TRACE
|
||||
|
||||
// if (x->GetSize() > 0)
|
||||
sxp = xdp;
|
||||
// if (x->GetSize() > 0)
|
||||
sxp = xdp;
|
||||
|
||||
xdp->SetInvalid(false);
|
||||
} else
|
||||
goto err;
|
||||
xdp->SetInvalid(false);
|
||||
} else
|
||||
goto err;
|
||||
|
||||
} else
|
||||
return RC_INFO; // Error or Physical table does not exist
|
||||
} else
|
||||
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);
|
||||
|
||||
return RC_OK;
|
||||
return rc;
|
||||
|
||||
err:
|
||||
if (sxp)
|
||||
|
||||
@@ -464,7 +464,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
|
||||
if (ApplyFilter(g, filp))
|
||||
break;
|
||||
|
||||
// passthru
|
||||
// fall through
|
||||
case RC_NF:
|
||||
continue;
|
||||
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)
|
||||
{
|
||||
int len = colp->GetLength(), prec = colp->GetScale();
|
||||
int len = colp->GetLength(), prec = colp->GetScale();
|
||||
bool un = colp->IsUnsigned();
|
||||
|
||||
// Currently no indexing on NULL columns
|
||||
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
|
||||
Type = colp->GetResultType();
|
||||
|
||||
if (!(Valp = AllocateValue(g, Type, len, prec, colp->IsUnsigned())))
|
||||
if (!(Valp = AllocateValue(g, Type, len, prec, un)))
|
||||
return true;
|
||||
|
||||
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,
|
||||
// and the one before last is to enable length/type checking, set to
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
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]
|
||||
&& 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);
|
||||
|
||||
// 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();
|
||||
|
||||
if (n[2]) {
|
||||
@@ -3088,7 +3090,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
||||
Bkeys.Sub = true;
|
||||
|
||||
// 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
|
||||
|
||||
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).
|
||||
// Currently we set it to true to be compatible with QRY blocks,
|
||||
// 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]) {
|
||||
Koff.Size = n[1] * sizeof(int);
|
||||
|
||||
Reference in New Issue
Block a user