mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
- Add extra column info in discovery
modified: storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/odbconn.cpp storage/connect/plgdbsem.h
This commit is contained in:
parent
d253599b83
commit
d05ccc2324
4 changed files with 44 additions and 25 deletions
|
@ -3555,7 +3555,7 @@ static bool add_fields(PGLOBAL g,
|
|||
#else // !NEW_WAY
|
||||
static bool add_field(String *sql, const char *field_name, int typ,
|
||||
int len, int dec, uint tm, const char *rem,
|
||||
char *dft, int flag, bool dbf, char v)
|
||||
char *dft, char *xtra, int flag, bool dbf, char v)
|
||||
{
|
||||
char var = (len > 255) ? 'V' : v;
|
||||
bool error= false;
|
||||
|
@ -3597,6 +3597,11 @@ static bool add_field(String *sql, const char *field_name, int typ,
|
|||
} else
|
||||
error|= sql->append(dft);
|
||||
|
||||
} // endif dft
|
||||
|
||||
if (xtra && *xtra) {
|
||||
error|= sql->append(" ");
|
||||
error|= sql->append(xtra);
|
||||
} // endif rem
|
||||
|
||||
if (rem && *rem) {
|
||||
|
@ -4106,7 +4111,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||
} // endif src
|
||||
|
||||
if (ok) {
|
||||
char *cnm, *rem, *dft;
|
||||
char *cnm, *rem, *dft, *xtra;
|
||||
int i, len, prec, dec, typ, flg;
|
||||
PDBUSER dup= PlgGetUser(g);
|
||||
PCATLG cat= (dup) ? dup->Catalog : NULL;
|
||||
|
@ -4217,7 +4222,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||
#else // !NEW_WAY
|
||||
// Now add the field
|
||||
if (add_field(&sql, cnm, typ, len, dec, NOT_NULL_FLAG,
|
||||
0, NULL, flg, dbf, 0))
|
||||
NULL, NULL, NULL, flg, dbf, 0))
|
||||
rc= HA_ERR_OUT_OF_MEM;
|
||||
#endif // !NEW_WAY
|
||||
} // endfor crp
|
||||
|
@ -4227,7 +4232,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||
typ= len= prec= dec= 0;
|
||||
tm= NOT_NULL_FLAG;
|
||||
cnm= (char*)"noname";
|
||||
dft= NULL;
|
||||
dft= xtra= NULL;
|
||||
#if defined(NEW_WAY)
|
||||
rem= "";
|
||||
// cs= NULL;
|
||||
|
@ -4271,6 +4276,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||
case FLD_DEFAULT:
|
||||
dft= crp->Kdata->GetCharValue(i);
|
||||
break;
|
||||
case FLD_EXTRA:
|
||||
xtra= crp->Kdata->GetCharValue(i);
|
||||
break;
|
||||
default:
|
||||
break; // Ignore
|
||||
} // endswitch Fld
|
||||
|
@ -4307,7 +4315,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||
rc= add_fields(g, thd, &alter_info, cnm, typ, prec, dec,
|
||||
tm, rem, 0, dbf, v);
|
||||
#else // !NEW_WAY
|
||||
if (add_field(&sql, cnm, typ, prec, dec, tm, rem, dft, 0, dbf, v))
|
||||
if (add_field(&sql, cnm, typ, prec, dec, tm, rem, dft, xtra,
|
||||
0, dbf, v))
|
||||
rc= HA_ERR_OUT_OF_MEM;
|
||||
#endif // !NEW_WAY
|
||||
} // endfor i
|
||||
|
|
|
@ -65,13 +65,15 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
|||
const char *table, const char *colpat,
|
||||
int port, bool info)
|
||||
{
|
||||
static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT,
|
||||
TYPE_STRING, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT,
|
||||
TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING};
|
||||
static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC,
|
||||
FLD_KEY, FLD_SCALE, FLD_RADIX, FLD_NULL,
|
||||
FLD_REM, FLD_NO, FLD_DEFAULT, FLD_CHARSET};
|
||||
static unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 32, 0, 32};
|
||||
int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT,
|
||||
TYPE_STRING, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT,
|
||||
TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING,
|
||||
TYPE_STRING};
|
||||
XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC,
|
||||
FLD_KEY, FLD_SCALE, FLD_RADIX, FLD_NULL,
|
||||
FLD_REM, FLD_NO, FLD_DEFAULT, FLD_EXTRA,
|
||||
FLD_CHARSET};
|
||||
unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
|
||||
char *fld, *fmt, v, cmd[128], uns[16], zero[16];
|
||||
int i, n, nf, ncol = sizeof(buftyp) / sizeof(int);
|
||||
int len, type, prec, rc, k = 0;
|
||||
|
@ -110,7 +112,7 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
|||
/* Get the size of the name and default columns. */
|
||||
/********************************************************************/
|
||||
length[0] = myc.GetFieldLength(0);
|
||||
length[10] = myc.GetFieldLength(5);
|
||||
// length[10] = myc.GetFieldLength(5);
|
||||
} else {
|
||||
n = 0;
|
||||
length[0] = 128;
|
||||
|
@ -130,7 +132,9 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
|||
case 4: crp->Name = "Length"; break;
|
||||
case 5: crp->Name = "Key"; break;
|
||||
case 10: crp->Name = "Date_fmt"; break;
|
||||
case 11: crp->Name = "Collation"; break;
|
||||
case 11: crp->Name = "Default"; break;
|
||||
case 12: crp->Name = "Extra"; break;
|
||||
case 13: crp->Name = "Collation"; break;
|
||||
} // endswitch i
|
||||
|
||||
if (info)
|
||||
|
@ -224,12 +228,17 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
|||
crp->Kdata->SetValue(fld, i);
|
||||
|
||||
crp = crp->Next; // Date format
|
||||
crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
|
||||
// crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
|
||||
crp->Kdata->SetValue(fmt, i);
|
||||
|
||||
crp = crp->Next; // New (default)
|
||||
fld = myc.GetCharField(5);
|
||||
crp->Kdata->SetValue(fld, i);
|
||||
|
||||
crp = crp->Next; // New (extra)
|
||||
fld = myc.GetCharField(6);
|
||||
crp->Kdata->SetValue(fld, i);
|
||||
|
||||
crp = crp->Next; // New (charset)
|
||||
fld = myc.GetCharField(2);
|
||||
crp->Kdata->SetValue(fld, i);
|
||||
|
|
|
@ -287,9 +287,9 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
|
|||
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING,
|
||||
TYPE_SHORT, TYPE_STRING, TYPE_INT, TYPE_INT,
|
||||
TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_STRING};
|
||||
XFLD fldtyp[] = {FLD_QUALIF, FLD_OWNER, FLD_TABNAME, FLD_NAME,
|
||||
FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH,
|
||||
FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM};
|
||||
XFLD fldtyp[] = {FLD_CAT, FLD_SCHEM, FLD_TABNAME, FLD_NAME,
|
||||
FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH,
|
||||
FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM};
|
||||
unsigned int length[] = {0, 0, 0, 0, 6, 0, 10, 10, 6, 6, 6, 0};
|
||||
int n, ncol = 12;
|
||||
PQRYRES qrp;
|
||||
|
@ -565,8 +565,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
|
|||
{
|
||||
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING,
|
||||
TYPE_STRING, TYPE_STRING};
|
||||
XFLD fldtyp[] = {FLD_QUALIF, FLD_OWNER, FLD_NAME,
|
||||
FLD_TYPE, FLD_REM};
|
||||
XFLD fldtyp[] = {FLD_CAT, FLD_SCHEM, FLD_NAME,
|
||||
FLD_TYPE, FLD_REM};
|
||||
unsigned int length[] = {0, 0, 0, 16, 0};
|
||||
int n, ncol = 5;
|
||||
PQRYRES qrp;
|
||||
|
|
|
@ -496,11 +496,12 @@ enum XFLD {FLD_NO = 0, /* Not a field definition item */
|
|||
FLD_CHARSET = 10, /* Field collation */
|
||||
FLD_KEY = 11, /* Field key property */
|
||||
FLD_DEFAULT = 12, /* Field default value */
|
||||
FLD_PRIV = 13, /* Field priviledges */
|
||||
FLD_DATEFMT = 14, /* Field date format */
|
||||
FLD_QUALIF = 15, /* Table qualifier */
|
||||
FLD_OWNER = 16, /* Table owner */
|
||||
FLD_TABNAME = 17}; /* Column Table name */
|
||||
FLD_EXTRA = 13, /* Field extra info */
|
||||
FLD_PRIV = 14, /* Field priviledges */
|
||||
FLD_DATEFMT = 15, /* Field date format */
|
||||
FLD_CAT = 16, /* Table catalog */
|
||||
FLD_SCHEM = 17, /* Table schema */
|
||||
FLD_TABNAME = 18}; /* Column Table name */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Result of last SQL noconv query. */
|
||||
|
|
Loading…
Reference in a new issue