Commit 50953a0e authored by Olivier Bertrand's avatar Olivier Bertrand

- Commit merge files

modified:
  storage/connect/catalog.h
  storage/connect/filamvct.cpp
  storage/connect/filamzip.cpp
  storage/connect/ha_connect.cc
  storage/connect/ha_connect.h
  storage/connect/mycat.cc
  storage/connect/mycat.h
  storage/connect/myconn.cpp
  storage/connect/mysql-test/connect/r/xml.result
  storage/connect/plgdbutl.cpp
  storage/connect/reldef.cpp
  storage/connect/reldef.h
  storage/connect/tabdos.cpp
  storage/connect/tabfmt.cpp
  storage/connect/tabmul.cpp
  storage/connect/tabmysql.cpp
  storage/connect/taboccur.cpp
  storage/connect/tabodbc.cpp
  storage/connect/tabpivot.cpp
  storage/connect/tabpivot.h
  storage/connect/tabsys.cpp
  storage/connect/tabtbl.cpp
  storage/connect/tabutil.cpp
  storage/connect/tabvct.cpp
  storage/connect/tabwmi.cpp
  storage/connect/tabxcl.cpp
  storage/connect/tabxml.cpp
  storage/connect/xindex.cpp
parents 81252031 213ecbbb
This diff is collapsed.
This diff is collapsed.
......@@ -652,13 +652,12 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
if (irc == RC_EF) {
LPCSTR name = Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
PCATLG cat = PlgGetCatalog(g);
defp->SetBlock(0);
defp->SetLast(Nrec);
if (!cat->SetIntCatInfo("Blocks", 0) ||
!cat->SetIntCatInfo("Last", 0)) {
if (!defp->SetIntCatInfo("Blocks", 0) ||
!defp->SetIntCatInfo("Last", 0)) {
sprintf(g->Message, MSG(UPDATE_ERROR), "Header");
return RC_FX;
} else
......@@ -677,7 +676,6 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
PCATLG cat = PlgGetCatalog(g);
LPCSTR name = Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
......@@ -696,8 +694,8 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
if (rc != RC_FX) {
defp->SetBlock(Block);
defp->SetLast(Last);
cat->SetIntCatInfo("Blocks", Block);
cat->SetIntCatInfo("Last", Last);
defp->SetIntCatInfo("Blocks", Block);
defp->SetIntCatInfo("Last", Last);
} // endif
gzclose(Zfile);
......@@ -1335,7 +1333,6 @@ void ZLBFAM::CloseTableFile(PGLOBAL g)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
PCATLG cat = PlgGetCatalog(g);
LPCSTR name = Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
......@@ -1355,8 +1352,8 @@ void ZLBFAM::CloseTableFile(PGLOBAL g)
if (rc != RC_FX) {
defp->SetBlock(Block);
defp->SetLast(Last);
cat->SetIntCatInfo("Blocks", Block);
cat->SetIntCatInfo("Last", Last);
defp->SetIntCatInfo("Blocks", Block);
defp->SetIntCatInfo("Last", Last);
} // endif
fclose(Stream);
......
......@@ -637,10 +637,16 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
/****************************************************************************/
TABTYPE ha_connect::GetRealType(PTOS pos)
{
TABTYPE type= GetTypeID(pos->type);
TABTYPE type;
if (pos || (pos= GetTableOptionStruct(table))) {
type= GetTypeID(pos->type);
if (type == TAB_UNDEF)
type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS;
if (type == TAB_UNDEF)
type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS;
} else
type= TAB_UNDEF;
return type;
} // end of GetRealType
......@@ -653,8 +659,8 @@ ulonglong ha_connect::table_flags() const
{
ulonglong flags= HA_CAN_VIRTUAL_COLUMNS | HA_REC_NOT_IN_SEQ |
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
HA_PARTIAL_COLUMN_READ |
// HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
HA_PARTIAL_COLUMN_READ | HA_FILE_BASED |
// HA_NULL_IN_KEY | not implemented yet
// HA_FAST_KEY_READ | causes error when sorting (???)
HA_NO_TRANSACTIONS | HA_DUPLICATE_KEY_NOT_IN_ORDER |
......@@ -1433,8 +1439,9 @@ int ha_connect::MakeRecord(char *buf)
} // endif colp
value= colp->GetValue();
p= NULL;
// All this could be better optimized
// All this was better optimized
if (!value->IsNull()) {
switch (value->GetType()) {
case TYPE_DATE:
......@@ -1459,39 +1466,37 @@ int ha_connect::MakeRecord(char *buf)
// Get date in the format required by MySQL fields
value->FormatValue(sdvalout, fmt);
p= sdvalout->GetCharValue();
rc= fp->store(p, strlen(p), charset, CHECK_FIELD_WARN);
break;
case TYPE_STRING:
case TYPE_DECIM:
p= value->GetCharString(val);
charset= tdbp->data_charset();
rc= fp->store(p, strlen(p), charset, CHECK_FIELD_WARN);
break;
case TYPE_DOUBLE:
p= NULL;
rc= fp->store(value->GetFloatValue());
break;
case TYPE_STRING:
// Passthru
default:
p= value->GetCharString(val);
rc= fp->store(value->GetBigintValue(), value->IsUnsigned());
break;
} // endswitch Type
if (p) {
if (fp->store(p, strlen(p), charset, CHECK_FIELD_WARN)) {
// Avoid "error" on null fields
if (value->GetIntValue())
rc= HA_ERR_WRONG_IN_RECORD;
// Store functions returns 1 on overflow and -1 on fatal error
if (rc > 0) {
char buf[128];
THD *thd= ha_thd();
DBUG_PRINT("MakeRecord", ("%s", p));
} // endif store
sprintf(buf, "Out of range value %s for column '%s' at row %ld",
value->GetCharString(val),
fp->field_name,
thd->get_stmt_da()->current_row_for_warning());
} else
if (fp->store(value->GetFloatValue())) {
// rc= HA_ERR_WRONG_IN_RECORD; a Warning was ignored
char buf[128];
THD *thd= ha_thd();
sprintf(buf, "Out of range value for column '%s' at row %ld",
fp->field_name,
thd->get_stmt_da()->current_row_for_warning());
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, buf);
DBUG_PRINT("MakeRecord", ("%s", value->GetCharString(val)));
} // endif store
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, buf);
DBUG_PRINT("MakeRecord", ("%s", buf));
rc= 0;
} else if (rc < 0)
rc= HA_ERR_WRONG_IN_RECORD;
fp->set_notnull();
} else
......@@ -2670,7 +2675,6 @@ int ha_connect::index_next(uchar *buf)
} // end of index_next
#ifdef NOT_USED
/**
@brief
Used to read backwards through the index.
......@@ -2678,9 +2682,15 @@ int ha_connect::index_next(uchar *buf)
int ha_connect::index_prev(uchar *buf)
{
DBUG_ENTER("ha_connect::index_prev");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
#endif // NOT_USED
int rc;
if (indexing > 0) {
rc= ReadIndexed(buf, OP_PREV);
} else
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
} // end of index_prev
/**
......@@ -3017,12 +3027,21 @@ int ha_connect::info(uint flag)
if (!valid_info) {
// tdbp must be available to get updated info
if (xp->CheckQuery(valid_query_id) || !tdbp) {
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
if (xmod == MODE_ANY || xmod == MODE_ALTER) {
// Pure info, not a query
pure= true;
xp->CheckCleanup();
} // endif xmod
// This is necessary for getting file length
if (cat && table)
cat->SetDataPath(g, table->s->db.str);
else
return HA_ERR_INTERNAL_ERROR; // Should never happen
tdbp= GetTDB(g);
} // endif tdbp
......@@ -4330,8 +4349,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
char v, spc= ',', qch= 0;
const char *fncn= "?";
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl;
char *tab, *dsn, *shm;
const char *col, *ocl, *rnk, *pic, *fcl, *skc;
char *tab, *dsn, *shm;
#if defined(WIN32)
char *nsp= NULL, *cls= NULL;
#endif // WIN32
......@@ -4360,7 +4379,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
if (!g)
return HA_ERR_INTERNAL_ERROR;
user= host= pwd= tbl= src= col= ocl= pic= fcl= rnk= dsn= NULL;
user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= dsn= NULL;
// Get the useful create options
ttp= GetTypeID(topt->type);
......@@ -4386,6 +4405,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
ocl= GetListOption(g, "occurcol", topt->oplist, NULL);
pic= GetListOption(g, "pivotcol", topt->oplist, NULL);
fcl= GetListOption(g, "fnccol", topt->oplist, NULL);
skc= GetListOption(g, "skipcol", topt->oplist, NULL);
rnk= GetListOption(g, "rankcol", topt->oplist, NULL);
pwd= GetListOption(g, "password", topt->oplist);
#if defined(WIN32)
......@@ -4652,7 +4672,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
break;
case TAB_PIVOT:
qrp= PivotColumns(g, tab, src, pic, fcl, host, db, user, pwd, port);
qrp= PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port);
break;
case TAB_OEM:
qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL);
......@@ -5236,7 +5256,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
// Get the index definitions
if (xdp= GetIndexInfo()) {
if (IsTypeIndexable(type)) {
if (GetIndexType(type) == 1) {
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
......@@ -5251,8 +5271,8 @@ int ha_connect::create(const char *name, TABLE *table_arg,
CloseTable(g);
} // endif cat
} else {
} else if (!GetIndexType(type)) {
sprintf(g->Message, "Table type %s is not indexable", options->type);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_UNSUPPORTED;
......@@ -5546,35 +5566,36 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
if (ha_alter_info->handler_flags & index_operations ||
!SameString(altered_table, "optname") ||
!SameBool(altered_table, "sepindex")) {
if (!IsTypeIndexable(type)) {
if (GetIndexType(type) == 1) {
g->Xchk= new(g) XCHK;
PCHK xcp= (PCHK)g->Xchk;
xcp->oldpix= GetIndexInfo(table->s);
xcp->newpix= GetIndexInfo(altered_table->s);
xcp->oldsep= GetBooleanOption("sepindex", false);
xcp->oldsep= xcp->SetName(g, GetStringOption("optname"));
tshp= altered_table->s;
xcp->newsep= GetBooleanOption("sepindex", false);
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
tshp= NULL;
if (xtrace && g->Xchk)
htrc(
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
xcp->oldsep, xcp->newsep,
SVP(xcp->oldopn), SVP(xcp->newopn),
xcp->oldpix, xcp->newpix);
if (sqlcom == SQLCOM_ALTER_TABLE)
idx= true;
else
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
} else if (!GetIndexType(type)) {
sprintf(g->Message, "Table type %s is not indexable", oldopt->type);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
DBUG_RETURN(HA_ALTER_ERROR);
} // endif Indexable
g->Xchk= new(g) XCHK;
PCHK xcp= (PCHK)g->Xchk;
xcp->oldpix= GetIndexInfo(table->s);
xcp->newpix= GetIndexInfo(altered_table->s);
xcp->oldsep= GetBooleanOption("sepindex", false);
xcp->oldsep= xcp->SetName(g, GetStringOption("optname"));
tshp= altered_table->s;
xcp->newsep= GetBooleanOption("sepindex", false);
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
tshp= NULL;
if (xtrace && g->Xchk)
htrc(
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
xcp->oldsep, xcp->newsep,
SVP(xcp->oldopn), SVP(xcp->newopn),
xcp->oldpix, xcp->newpix);
if (sqlcom == SQLCOM_ALTER_TABLE)
idx= true;
else
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
} // endif index type
} // endif index operation
......
......@@ -180,7 +180,7 @@ public:
// CONNECT Implementation
static bool connect_init(void);
static bool connect_end(void);
TABTYPE GetRealType(PTOS pos);
TABTYPE GetRealType(PTOS pos= NULL);
char *GetStringOption(char *opname, char *sdef= NULL);
PTOS GetTableOptionStruct(TABLE *table_arg);
bool GetBooleanOption(char *opname, bool bdef);
......@@ -256,8 +256,8 @@ public:
*/
ulong index_flags(uint inx, uint part, bool all_parts) const
{
return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER
| HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER |
HA_READ_PREV | HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
} // end of index_flags
/** @brief
......@@ -421,7 +421,7 @@ PFIL CondFilter(PGLOBAL g, Item *cond);
We implement this in ha_connect.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
//int index_prev(uchar *buf);
int index_prev(uchar *buf);
/** @brief
We implement this in ha_connect.cc. It's not an obligatory method;
......
This diff is collapsed.
......@@ -40,6 +40,7 @@ bool IsExactType(TABTYPE type);
bool IsTypeNullable(TABTYPE type);
bool IsTypeFixed(TABTYPE type);
bool IsTypeIndexable(TABTYPE type);
int GetIndexType(TABTYPE type);
uint GetFuncID(const char *func);
/***********************************************************************/
......@@ -57,14 +58,6 @@ class MYCAT : public CATALOG {
void Reset(void);
void SetDataPath(PGLOBAL g, const char *path)
{SetPath(g, &DataPath, path);}
bool GetBoolCatInfo(PSZ what, bool bdef);
bool SetIntCatInfo(PSZ what, int ival);
int GetIntCatInfo(PSZ what, int idef);
int GetSizeCatInfo(PSZ what, PSZ sdef);
int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size);
char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef);
int GetColCatInfo(PGLOBAL g, PTABDEF defp);
bool GetIndexInfo(PGLOBAL g, PTABDEF defp);
bool StoreIndex(PGLOBAL g, PTABDEF defp) {return false;} // Temporary
PRELDEF GetTableDesc(PGLOBAL g, LPCSTR name,
LPCSTR type, PRELDEF *prp = NULL);
......
......@@ -365,7 +365,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
int pt)
{
const char *pipe = NULL;
uint cto = 60, nrt = 120;
uint cto = 6000, nrt = 12000;
m_DB = mysql_init(NULL);
......
......@@ -326,6 +326,9 @@ Warnings:
Level Warning
Code 1366
Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column 'c' at row 1
Level Warning
Code 1105
Message Out of range value ÁÂÃÄÅÆÇ for column 'c' at row 1
DROP TABLE t1;
#
# Testing Cyrillic
......
......@@ -374,7 +374,7 @@ PCATLG PlgGetCatalog(PGLOBAL g, bool jump)
} // end of PlgGetCatalog
/***********************************************************************/
/* PlgGetCatalog: returns CATALOG class pointer. */
/* PlgGetDataPath: returns the default data path. */
/***********************************************************************/
char *PlgGetDataPath(PGLOBAL g)
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -415,10 +415,10 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (DOSDEF::DefineAM(g, "CSV", poff))
return true;
Cat->GetCharCatInfo("Separator", ",", buf, sizeof(buf));
GetCharCatInfo("Separator", ",", buf, sizeof(buf));
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
Quoted = Cat->GetIntCatInfo("Quoted", -1);
Cat->GetCharCatInfo("Qchar", "", buf, sizeof(buf));
Quoted = GetIntCatInfo("Quoted", -1);
GetCharCatInfo("Qchar", "", buf, sizeof(buf));
Qot = *buf;
if (Qot && Quoted < 0)
......@@ -427,9 +427,9 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Qot = '"';
Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f')));
Header = (Cat->GetIntCatInfo("Header", 0) != 0);
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
Header = (GetIntCatInfo("Header", 0) != 0);
Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = (GetIntCatInfo("Accept", 0) != 0);
return false;
} // end of DefineAM
......
......@@ -591,9 +591,9 @@ void TDBMUL::CloseDB(PGLOBAL g)
/***********************************************************************/
bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Incl = (Cat->GetIntCatInfo("Subdir", 0) != 0);
Huge = (Cat->GetIntCatInfo("Huge", 0) != 0);
Desc = Fn = GetStringCatInfo(g, "Filename", NULL);
Incl = (GetIntCatInfo("Subdir", 0) != 0);
Huge = (GetIntCatInfo("Huge", 0) != 0);
return false;
} // end of DefineAM
......
......@@ -267,23 +267,23 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
// For unspecified values, get the values of old style options
// but only if called from MYSQLDEF, else set them to NULL
Portnumber = (sport && sport[0]) ? atoi(sport)
: (b) ? Cat->GetIntCatInfo("Port", GetDefaultPort()) : 0;
Portnumber = (sport && sport[0]) ? atoi(sport)
: (b) ? GetIntCatInfo("Port", GetDefaultPort()) : 0;
if (Username[0] == 0)
Username = (b) ? Cat->GetStringCatInfo(g, "User", "*") : NULL;
Username = (b) ? GetStringCatInfo(g, "User", "*") : NULL;
if (Hostname[0] == 0)
Hostname = (b) ? Cat->GetStringCatInfo(g, "Host", "localhost") : NULL;
Hostname = (b) ? GetStringCatInfo(g, "Host", "localhost") : NULL;
if (!Database || !*Database)
Database = (b) ? Cat->GetStringCatInfo(g, "Database", "*") : NULL;
Database = (b) ? GetStringCatInfo(g, "Database", "*") : NULL;
if (!Tabname || !*Tabname)
Tabname = (b) ? Cat->GetStringCatInfo(g, "Tabname", Name) : NULL;
Tabname = (b) ? GetStringCatInfo(g, "Tabname", Name) : NULL;
if (!Password)
Password = (b) ? Cat->GetStringCatInfo(g, "Password", NULL) : NULL;
Password = (b) ? GetStringCatInfo(g, "Password", NULL) : NULL;
} // endif URL
#if 0
......@@ -308,37 +308,37 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (stricmp(am, "MYPRX")) {
// Normal case of specific MYSQL table
url = Cat->GetStringCatInfo(g, "Connect", NULL);
url = GetStringCatInfo(g, "Connect", NULL);
if (!url || !*url) {
// Not using the connection URL
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
Database = Cat->GetStringCatInfo(g, "Database", "*");
Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Username = Cat->GetStringCatInfo(g, "User", "*");
Password = Cat->GetStringCatInfo(g, "Password", NULL);
Portnumber = Cat->GetIntCatInfo("Port", GetDefaultPort());
Hostname = GetStringCatInfo(g, "Host", "localhost");
Database = GetStringCatInfo(g, "Database", "*");
Tabname = GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
Username = GetStringCatInfo(g, "User", "*");
Password = GetStringCatInfo(g, "Password", NULL);
Portnumber = GetIntCatInfo("Port", GetDefaultPort());
Server = Hostname;
} else if (ParseURL(g, url))
return true;
Bind = !!Cat->GetIntCatInfo("Bind", 0);
Delayed = !!Cat->GetIntCatInfo("Delayed", 0);
Bind = !!GetIntCatInfo("Bind", 0);
Delayed = !!GetIntCatInfo("Delayed", 0);
} else {
// MYSQL access from a PROXY table
Database = Cat->GetStringCatInfo(g, "Database", "*");
Isview = Cat->GetBoolCatInfo("View", FALSE);
// MYSQL access from a PROXY table
Database = GetStringCatInfo(g, "Database", "*");
Isview = GetBoolCatInfo("View", FALSE);
// We must get other connection parms from the calling table
Remove_tshp(Cat);
url = Cat->GetStringCatInfo(g, "Connect", NULL);
url = GetStringCatInfo(g, "Connect", NULL);
if (!url || !*url) {
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
Username = Cat->GetStringCatInfo(g, "User", "*");
Password = Cat->GetStringCatInfo(g, "Password", NULL);
Portnumber = Cat->GetIntCatInfo("Port", GetDefaultPort());
if (!url || !*url) {
Hostname = GetStringCatInfo(g, "Host", "localhost");
Username = GetStringCatInfo(g, "User", "*");
Password = GetStringCatInfo(g, "Password", NULL);
Portnumber = GetIntCatInfo("Port", GetDefaultPort());
Server = Hostname;
} else {
char *locdb = Database;
......@@ -352,16 +352,16 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Tabname = Name;
} // endif am
if ((Srcdef = Cat->GetStringCatInfo(g, "Srcdef", NULL)))
if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
Isview = true;
// Used for Update and Delete
Qrystr = Cat->GetStringCatInfo(g, "Query_String", "?");
Quoted = Cat->GetIntCatInfo("Quoted", 0);
Qrystr = GetStringCatInfo(g, "Query_String", "?");
Quoted = GetIntCatInfo("Quoted", 0);
// Specific for command executing tables
Xsrc = Cat->GetBoolCatInfo("Execsrc", false);
Mxr = Cat->GetIntCatInfo("Maxerr", 0);
Xsrc = GetBoolCatInfo("Execsrc", false);
Mxr = GetIntCatInfo("Maxerr", 0);
return FALSE;
} // end of DefineAM
......
......@@ -264,9 +264,9 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
/***********************************************************************/
bool OCCURDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
Rcol = Cat->GetStringCatInfo(g, "RankCol", "");
Colist = Cat->GetStringCatInfo(g, "Colist", "");
Xcol = Cat->GetStringCatInfo(g, "OccurCol", Colist);
Rcol = GetStringCatInfo(g, "RankCol", "");
Colist = GetStringCatInfo(g, "Colist", "");
Xcol = GetStringCatInfo(g, "OccurCol", Colist);
return PRXDEF::DefineAM(g, am, poff);
} // end of DefineAM
......
......@@ -100,22 +100,22 @@ ODBCDEF::ODBCDEF(void)
/***********************************************************************/
bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
Desc = Connect = Cat->GetStringCatInfo(g, "Connect", "");
Tabname = Cat->GetStringCatInfo(g, "Name",
Desc = Connect = GetStringCatInfo(g, "Connect", "");
Tabname = GetStringCatInfo(g, "Name",
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Tabschema = Cat->GetStringCatInfo(g, "Dbname", NULL);
Tabschema = Cat->GetStringCatInfo(g, "Schema", Tabschema);
Tabcat = Cat->GetStringCatInfo(g, "Qualifier", NULL);
Tabcat = Cat->GetStringCatInfo(g, "Catalog", Tabcat);
Srcdef = Cat->GetStringCatInfo(g, "Srcdef", NULL);
Qrystr = Cat->GetStringCatInfo(g, "Query_String", "?");
Sep = Cat->GetStringCatInfo(g, "Separator", NULL);
Catver = Cat->GetIntCatInfo("Catver", 2);
Xsrc = Cat->GetBoolCatInfo("Execsrc", FALSE);
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Maxres = Cat->GetIntCatInfo("Maxres", 0);
Quoted = Cat->GetIntCatInfo("Quoted", 0);
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
Tabschema = GetStringCatInfo(g, "Dbname", NULL);
Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
Srcdef = GetStringCatInfo(g, "Srcdef", NULL);
Qrystr = GetStringCatInfo(g, "Query_String", "?");
Sep = GetStringCatInfo(g, "Separator", NULL);
Catver = GetIntCatInfo("Catver", 2);
Xsrc = GetBoolCatInfo("Execsrc", FALSE);
Maxerr = GetIntCatInfo("Maxerr", 0);
Maxres = GetIntCatInfo("Maxres", 0);
Quoted = GetIntCatInfo("Quoted", 0);
Options = ODBConn::noOdbcDialog;
Pseudo = 2; // FILID is Ok but not ROWID
return false;
......
......@@ -58,11 +58,11 @@ extern "C" int trace;
/***********************************************************************/
PQRYRES PivotColumns(PGLOBAL g, const char *tab, const char *src,
const char *picol, const char *fncol,
const char *host, const char *db,
const char *user, const char *pwd,
int port)
const char *skcol, const char *host,
const char *db, const char *user,
const char *pwd, int port)
{
PIVAID pvd(tab, src, picol, fncol, host, db, user, pwd, port);
PIVAID pvd(tab, src, picol, fncol, skcol, host, db, user, pwd, port);
return pvd.MakePivotColumns(g);
} // end of PivotColumns
......@@ -72,10 +72,10 @@ PQRYRES PivotColumns(PGLOBAL g, const char *tab, const char *src,
/***********************************************************************/
/* PIVAID constructor. */
/***********************************************************************/
PIVAID::PIVAID(const char *tab, const char *src, const char *picol,
const char *fncol, const char *host, const char *db,
const char *user, const char *pwd, int port)
: CSORT(false)
PIVAID::PIVAID(const char *tab, const char *src, const char *picol,
const char *fncol, const char *skcol, const char *host,
const char *db, const char *user, const char *pwd,
int port) : CSORT(false)
{
Host = (char*)host;
User = (char*)user;
......@@ -86,19 +86,34 @@ PIVAID::PIVAID(const char *tab, const char *src, const char *picol,
Tabsrc = (char*)src;
Picol = (char*)picol;
Fncol = (char*)fncol;
Skcol = (char*)skcol;
Rblkp = NULL;
Port = (port) ? port : GetDefaultPort();
} // end of PIVAID constructor
/***********************************************************************/
/* Skip columns that are in the skipped column list. */
/***********************************************************************/
bool PIVAID::SkipColumn(PCOLRES crp, char *skc)
{
if (skc)
for (char *p = skc; *p; p += (strlen(p) + 1))
if (!stricmp(crp->Name, p))
return true;
return false;
} // end of SkipColumn
/***********************************************************************/
/* Make the Pivot table column list. */
/***********************************************************************/
PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
{
char *query, *colname, buf[64];
char *p, *query, *colname, *skc, buf[64];
int rc, ndif, nblin, w = 0;
bool b = false;
PVAL valp;
PVAL valp;
PQRYRES qrp;
PCOLRES *pcrp, crp, fncrp = NULL;
// Save stack and allocation environment and prepare error return
......@@ -111,10 +126,25 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
goto err;
} // endif rc
// Are there columns to skip?
if (Skcol) {
uint n = strlen(Skcol);
skc = (char*)PlugSubAlloc(g, NULL, n + 2);
strcpy(skc, Skcol);
skc[n + 1] = 0;
// Replace ; by nulls in skc
for (p = strchr(skc, ';'); p; p = strchr(p, ';'))
*p++ = 0;
} else
skc = NULL;
if (!Tabsrc && Tabname) {
// Locate the query
query = (char*)PlugSubAlloc(g, NULL, strlen(Tabname) + 16);
sprintf(query, "SELECT * FROM %s", Tabname);
query = (char*)PlugSubAlloc(g, NULL, strlen(Tabname) + 26);
sprintf(query, "SELECT * FROM `%s` LIMIT 1", Tabname);
} else if (!Tabsrc) {
strcpy(g->Message, MSG(SRC_TABLE_UNDEF));
return NULL;
......@@ -132,18 +162,17 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
goto err;
// We must have a storage query to get pivot column values
Qryp = Myc.GetResult(g, true);
Myc.Close();
b = false;
if (!(Qryp = Myc.GetResult(g, true)))
goto err;
if (!Fncol) {
for (crp = Qryp->Colresp; crp; crp = crp->Next)
if (!Picol || stricmp(Picol, crp->Name))
if ((!Picol || stricmp(Picol, crp->Name)) && !SkipColumn(crp, skc))
Fncol = crp->Name;
if (!Fncol) {
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
return NULL;
goto err;
} // endif Fncol
} // endif Fncol
......@@ -151,22 +180,25 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
if (!Picol) {
// Find default Picol as the last one not equal to Fncol
for (crp = Qryp->Colresp; crp; crp = crp->Next)
if (stricmp(Fncol, crp->Name))
if (stricmp(Fncol, crp->Name) && !SkipColumn(crp, skc))
Picol = crp->Name;
if (!Picol) {
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
return NULL;
goto err;
} // endif Picol
} // endif picol
// Prepare the column list
for (pcrp = &Qryp->Colresp; crp = *pcrp; )
if (!stricmp(Picol, crp->Name)) {
if (SkipColumn(crp, skc)) {
// Ignore this column
*pcrp = crp->Next;
} else if (!stricmp(Picol, crp->Name)) {
if (crp->Nulls) {
sprintf(g->Message, "Pivot column %s cannot be nullable", Picol);
return NULL;
goto err;
} // endif Nulls
Rblkp = crp->Kdata;
......@@ -179,31 +211,59 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
if (!Rblkp) {
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
return NULL;
goto err;
} else if (!fncrp) {
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
return NULL;
goto err;
} // endif
// Before calling sort, initialize all
nblin = Qryp->Nblin;
if (Tabsrc) {
Myc.Close();
b = false;
Index.Size = nblin * sizeof(int);
Index.Sub = TRUE; // Should be small enough
// Before calling sort, initialize all
nblin = Qryp->Nblin;
if (!PlgDBalloc(g, NULL, Index))
return NULL;
Index.Size = nblin * sizeof(int);
Index.Sub = TRUE; // Should be small enough
Offset.Size = (nblin + 1) * sizeof(int);
Offset.Sub = TRUE; // Should be small enough
if (!PlgDBalloc(g, NULL, Index))
return NULL;
if (!PlgDBalloc(g, NULL, Offset))
return NULL;
Offset.Size = (nblin + 1) * sizeof(int);
Offset.Sub = TRUE; // Should be small enough
if (!PlgDBalloc(g, NULL, Offset))
return NULL;
ndif = Qsort(g, nblin);
ndif = Qsort(g, nblin);
if (ndif < 0) // error
return NULL;
if (ndif < 0) // error
return NULL;
} else {
// The query was limited, we must get pivot column values
query = (char*)PlugSubAlloc(g, NULL, 0);
sprintf(query, "SELECT DISTINCT `%s` FROM `%s`", Picol, Tabname);
PlugSubAlloc(g, NULL, strlen(query) + 1);
Myc.FreeResult();
// Send the source command to MySQL
if (Myc.ExecSQL(g, query, &w) == RC_FX)
goto err;
// We must have a storage query to get pivot column values
if (!(qrp = Myc.GetResult(g, true)))
goto err;
Myc.Close();
b = false;
// Get the column list
crp = qrp->Colresp;
Rblkp = crp->Kdata;
ndif = qrp->Nblin;
} // endif Tabsrc
// Allocate the Value used to retieve column names
if (!(valp = AllocateValue(g, Rblkp->GetType(),
......@@ -220,7 +280,11 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
crp = fncrp;
// Get the value that will be the generated column name
valp->SetValue_pvblk(Rblkp, Pex[Pof[i]]);
if (Tabsrc)
valp->SetValue_pvblk(Rblkp, Pex[Pof[i]]);
else
valp->SetValue_pvblk(Rblkp, i);
colname = valp->GetCharString(buf);
crp->Name = (char*)PlugSubAlloc(g, NULL, strlen(colname) + 1);
strcpy(crp->Name, colname);
......@@ -280,11 +344,11 @@ bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
DB = (char*)Tablep->GetQualifier();
Tabsrc = (char*)Tablep->GetSrc();
Host = Cat->GetStringCatInfo(g, "Host", "localhost");
User = Cat->GetStringCatInfo(g, "User", "*");
Pwd = Cat->GetStringCatInfo(g, "Password", NULL);
Picol = Cat->GetStringCatInfo(g, "PivotCol", NULL);
Fncol = Cat->GetStringCatInfo(g, "FncCol", NULL);
Host = GetStringCatInfo(g, "Host", "localhost");
User = GetStringCatInfo(g, "User", "*");
Pwd = GetStringCatInfo(g, "Password", NULL);
Picol = GetStringCatInfo(g, "PivotCol", NULL);
Fncol = GetStringCatInfo(g, "FncCol", NULL);
// If fncol is like avg(colname), separate Fncol and Function
if (Fncol && (p1 = strchr(Fncol, '(')) && (p2 = strchr(p1, ')')) &&
......@@ -293,11 +357,11 @@ bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Function = Fncol;
Fncol = p1;
} else
Function = Cat->GetStringCatInfo(g, "Function", "SUM");
Function = GetStringCatInfo(g, "Function", "SUM");
GBdone = Cat->GetBoolCatInfo("Groupby", false);
Accept = Cat->GetBoolCatInfo("Accept", false);
Port = Cat->GetIntCatInfo("Port", 3306);
GBdone = GetBoolCatInfo("Groupby", false);
Accept = GetBoolCatInfo("Accept", false);
Port = GetIntCatInfo("Port", 3306);
Desc = (Tabsrc) ? Tabsrc : Tabname;
return FALSE;
} // end of DefineAM
......
......@@ -18,12 +18,13 @@ class PIVAID : public CSORT {
friend class SRCCOL;
public:
// Constructor
PIVAID(const char *tab, const char *src, const char *picol,
const char *fncol, const char *host, const char *db,
const char *user, const char *pwd, int port);
PIVAID(const char *tab, const char *src, const char *picol,
const char *fncol, const char *skcol, const char *host,
const char *db, const char *user, const char *pwd, int port);
// Methods
PQRYRES MakePivotColumns(PGLOBAL g);
bool SkipColumn(PCOLRES crp, char *skc);
// The sorting function
virtual int Qcompare(int *, int *);
......@@ -40,6 +41,7 @@ class PIVAID : public CSORT {
char *Tabsrc; // SQL of source table
char *Picol; // Pivot column name
char *Fncol; // Function column name
char *Skcol; // Skipped columns
PVBLK Rblkp; // The value block of the pivot column
int Port; // MySQL port number
}; // end of class PIVAID
......@@ -191,6 +193,6 @@ class SRCCOL : public PRXCOL {
PQRYRES PivotColumns(PGLOBAL g, const char *tab, const char *src,
const char *picol, const char *fncol,
const char *host, const char *db,
const char *user, const char *pwd,
int port);
const char *skcol, const char *host,
const char *db, const char *user,
const char *pwd, int port);
......@@ -76,8 +76,8 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char buf[8];
Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf));
Fn = GetStringCatInfo(g, "Filename", NULL);
GetCharCatInfo("Layout", "C", buf, sizeof(buf));
Layout = toupper(*buf);
if (Fn) {
......@@ -90,7 +90,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endif Fn
Ln = Cat->GetSizeCatInfo("Secsize", "8K");
Ln = GetSizeCatInfo("Secsize", "8K");
Desc = Fn;
return false;
} // end of DefineAM
......
......@@ -111,9 +111,9 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
char *tablist, *dbname, *def = NULL;
Desc = "Table list table";
tablist = Cat->GetStringCatInfo(g, "Tablist", "");
dbname = Cat->GetStringCatInfo(g, "Dbname", "*");
def = Cat->GetStringCatInfo(g, "Srcdef", NULL);
tablist = GetStringCatInfo(g, "Tablist", "");
dbname = GetStringCatInfo(g, "Dbname", "*");
def = GetStringCatInfo(g, "Srcdef", NULL);
Ntables = 0;
if (*tablist) {
......@@ -155,9 +155,9 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endfor pdb
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Accept = Cat->GetBoolCatInfo("Accept", false);
Thread = Cat->GetBoolCatInfo("Thread", false);
Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = GetBoolCatInfo("Accept", false);
Thread = GetBoolCatInfo("Thread", false);
} // endif tablist
return FALSE;
......
......@@ -307,10 +307,10 @@ bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char *pn, *db, *tab, *def = NULL;
db = Cat->GetStringCatInfo(g, "Dbname", "*");
def = Cat->GetStringCatInfo(g, "Srcdef", NULL);
db = GetStringCatInfo(g, "Dbname", "*");
def = GetStringCatInfo(g, "Srcdef", NULL);
if (!(tab = Cat->GetStringCatInfo(g, "Tabname", NULL))) {
if (!(tab = GetStringCatInfo(g, "Tabname", NULL))) {
if (!def) {
strcpy(g->Message, "Missing object table definition");
return TRUE;
......
......@@ -95,13 +95,13 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
DOSDEF::DefineAM(g, "BIN", poff);
Estimate = Cat->GetIntCatInfo("Estimate", 0);
Split = Cat->GetIntCatInfo("Split", (Estimate) ? 0 : 1);
Header = Cat->GetIntCatInfo("Header", 0);
Estimate = GetIntCatInfo("Estimate", 0);
Split = GetIntCatInfo("Split", (Estimate) ? 0 : 1);
Header = GetIntCatInfo("Header", 0);
// CONNECT must have Block/Last info for VEC tables
if (Estimate && !Split && !Header) {
char *fn = Cat->GetStringCatInfo(g, "Filename", "?");
char *fn = GetStringCatInfo(g, "Filename", "?");
// No separate header file fo urbi tables
Header = (*fn == '?') ? 3 : 2;
......@@ -112,7 +112,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
// For packed files the logical record length is calculated in poff
if (poff != Lrecl) {
Lrecl = poff;
Cat->SetIntCatInfo("Lrecl", poff);
SetIntCatInfo("Lrecl", poff);
} // endif poff
Padded = false;
......
......@@ -335,8 +335,8 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info)
/***********************************************************************/
bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
Nspace = Cat->GetStringCatInfo(g, "Namespace", "Root\\CimV2");
Wclass = Cat->GetStringCatInfo(g, "Class",
Nspace = GetStringCatInfo(g, "Namespace", "Root\\CimV2");
Wclass = GetStringCatInfo(g, "Class",
(!stricmp(Nspace, "root\\cimv2") ? "ComputerSystemProduct" :
!stricmp(Nspace, "root\\cli") ? "Msft_CliAlias" : ""));
......@@ -349,7 +349,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endif Wclass
if (Catfunc == FNC_NO)
Ems = Cat->GetIntCatInfo("Estimate", 100);
Ems = GetIntCatInfo("Estimate", 100);
return false;
} // end of DefineAM
......
......@@ -78,10 +78,10 @@ bool XCLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char buf[8];
Xcol = Cat->GetStringCatInfo(g, "Colname", "");
Cat->GetCharCatInfo("Separator", ",", buf, sizeof(buf));
Xcol = GetStringCatInfo(g, "Colname", "");
GetCharCatInfo("Separator", ",", buf, sizeof(buf));
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
Mult = Cat->GetIntCatInfo("Mult", 10);
Mult = GetIntCatInfo("Mult", 10);
return PRXDEF::DefineAM(g, am, poff);
} // end of DefineAM
......
......@@ -95,21 +95,21 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
//void *memp = Cat->GetDescp();
//PSZ dbfile = Cat->GetDescFile();
Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Encoding = Cat->GetStringCatInfo(g, "Encoding", "UTF-8");
Fn = GetStringCatInfo(g, "Filename", NULL);
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
if (*Fn == '?') {
strcpy(g->Message, MSG(MISSING_FNAME));
return true;
} // endif fn
if ((signed)Cat->GetIntCatInfo("Flag", -1) != -1) {
if ((signed)GetIntCatInfo("Flag", -1) != -1) {
strcpy(g->Message, MSG(DEPREC_FLAG));
return true;
} // endif flag
defrow = defcol = "";
Cat->GetCharCatInfo("Coltype", "", buf, sizeof(buf));
GetCharCatInfo("Coltype", "", buf, sizeof(buf));
switch (toupper(*buf)) {
case 'A': // Attribute
......@@ -136,25 +136,25 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endswitch typname
Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); // Deprecated
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow);
Colname = Cat->GetStringCatInfo(g, "Colnode", defcol);
Mulnode = Cat->GetStringCatInfo(g, "Mulnode", "");
XmlDB = Cat->GetStringCatInfo(g, "XmlDB", "");
Nslist = Cat->GetStringCatInfo(g, "Nslist", "");
DefNs = Cat->GetStringCatInfo(g, "DefNs", "");
Limit = Cat->GetIntCatInfo("Limit", 2);
Xpand = (Cat->GetIntCatInfo("Expand", 0) != 0);
Header = Cat->GetIntCatInfo("Header", 0);
Cat->GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
Tabname = GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = GetStringCatInfo(g, "Table_name", Tabname); // Deprecated
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
Rowname = GetStringCatInfo(g, "Rownode", defrow);
Colname = GetStringCatInfo(g, "Colnode", defcol);
Mulnode = GetStringCatInfo(g, "Mulnode", "");
XmlDB = GetStringCatInfo(g, "XmlDB", "");
Nslist = GetStringCatInfo(g, "Nslist", "");
DefNs = GetStringCatInfo(g, "DefNs", "");
Limit = GetIntCatInfo("Limit", 2);
Xpand = (GetIntCatInfo("Expand", 0) != 0);
Header = GetIntCatInfo("Header", 0);
GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
//if (*buf == '*') // Try the old (deprecated) option
// Cat->GetCharCatInfo("Method", "*", buf, sizeof(buf));
// GetCharCatInfo("Method", "*", buf, sizeof(buf));
//if (*buf == '*') // Is there a default for the database?
// Cat->GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
// GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
// Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise
......@@ -168,8 +168,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D');
// Get eventual table node attribute
Attrib = Cat->GetStringCatInfo(g, "Attribute", "");
Hdattr = Cat->GetStringCatInfo(g, "HeadAttr", "");
Attrib = GetStringCatInfo(g, "Attribute", "");
Hdattr = GetStringCatInfo(g, "HeadAttr", "");
return false;
} // end of DefineAM
......
......@@ -723,7 +723,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
return true;
} // endswitch Ftype
if ((sep = dup->Catalog->GetBoolCatInfo("SepIndex", false))) {
if ((sep = defp->GetBoolCatInfo("SepIndex", false))) {
// Index is saved in a separate file
#if !defined(UNIX)
char drive[_MAX_DRIVE];
......@@ -1627,7 +1627,7 @@ int XINDEX::Fetch(PGLOBAL g)
switch (Op) {
case OP_NEXT: // Read next
if (NextVal(false))
return -1; // End of indexed file
return -1; // End of indexed file
break;
case OP_FIRST: // Read first
......@@ -1643,7 +1643,7 @@ int XINDEX::Fetch(PGLOBAL g)
if (NextVal(true)) {
Op = OP_EQ;
return -2; // no more equal values
return -2; // no more equal values
} // endif NextVal
break;
......@@ -1651,9 +1651,9 @@ int XINDEX::Fetch(PGLOBAL g)
// while (!NextVal(true)) ;
// if (Cur_K >= Num_K)
// return -1; // End of indexed file
// return -1; // End of indexed file
if (NextValDif())
return -1; // End of indexed file
return -1; // End of indexed file
break;
case OP_FSTDIF: // Read first diff
......@@ -1662,12 +1662,17 @@ int XINDEX::Fetch(PGLOBAL g)
Op = (Mul || Nval < Nk) ? OP_NXTDIF : OP_NEXT;
break;
case OP_LAST: // Read last key
case OP_LAST: // Read last key
for (Cur_K = Num_K - 1, kp = To_KeyCol; kp; kp = kp->Next)
kp->Val_K = kp->Kblp->GetNval() - 1;
Op = OP_NEXT;
break;
case OP_PREV: // Read previous
if (PrevVal())
return -1; // End of indexed file
break;
default: // Should be OP_EQ
// if (Tbxp->Key_Rank < 0) {
/***************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment