1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2022-10-25 10:04:37 +03:00
68 changed files with 1349 additions and 130 deletions

View File

@@ -159,6 +159,9 @@ bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Maxerr = GetIntCatInfo("Maxerr", 0);
Maxres = GetIntCatInfo("Maxres", 0);
Quoted = GetIntCatInfo("Quoted", 0);
Qchar = GetStringCatInfo(g,"Qchar", NULL);
if (Qchar && !Quoted)
Quoted = 1;
Options = 0;
Cto = 0;
Qto = 0;
@@ -198,6 +201,7 @@ TDBEXT::TDBEXT(EXTDEF *tdp) : TDB(tdp)
Cto = tdp->Cto;
Qto = tdp->Qto;
Quoted = MY_MAX(0, tdp->GetQuoted());
Quote = tdp->GetQchar();
Rows = tdp->GetElemt();
Memory = tdp->Memory;
Scrollable = tdp->Scrollable;
@@ -214,12 +218,12 @@ TDBEXT::TDBEXT(EXTDEF *tdp) : TDB(tdp)
Cto = 0;
Qto = 0;
Quoted = 0;
Quote = NULL;
Rows = 0;
Memory = 0;
Scrollable = false;
} // endif tdp
Quote = NULL;
Query = NULL;
Count = NULL;
//Where = NULL;
@@ -252,6 +256,7 @@ TDBEXT::TDBEXT(PTDBEXT tdbp) : TDB(tdbp)
Cto = tdbp->Cto;
Qto = tdbp->Qto;
Quoted = tdbp->Quoted;
Quote = tdbp->Quote;
Rows = tdbp->Rows;
Memory = tdbp->Memory;
Scrollable = tdbp->Scrollable;
@@ -389,6 +394,8 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
int len;
bool first = true;
PCOL colp;
char *res= NULL, *my_schema_table= NULL;
size_t my_len= 0;
if (Srcdef)
return MakeSrcdef(g);
@@ -458,10 +465,37 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
Decode(TableName, buf, sizeof(buf));
if (Quote) {
// Put table name between identifier quotes in case in contains blanks
Query->Append(Quote);
Query->Append(buf);
Query->Append(Quote);
// Tabname can have both database and table identifiers, we need to parse
if (res= strstr(buf, "."))
{
// Parse schema
my_len= res - buf + 1;
my_schema_table= (char *) malloc(my_len);
memcpy(my_schema_table, buf, my_len - 1);
my_schema_table[my_len] = 0;
Query->Append(Quote);
Query->Append(my_schema_table);
Query->Append(Quote);
free(my_schema_table);
Query->Append(".");
// Parse table
my_len= strlen(buf) - my_len + 1;
my_schema_table= (char *) malloc(my_len);
memcpy(my_schema_table, ++res, my_len);
my_schema_table[my_len] = 0;
Query->Append(Quote);
Query->Append(my_schema_table);
Query->Append(Quote);
free(my_schema_table);
}
else
{
// Put table name between identifier quotes in case in contains blanks
Query->Append(Quote);
Query->Append(buf);
Query->Append(Quote);
}
} else
Query->Append(buf);