mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Resolving conflicts
modified: storage/connect/block.h storage/connect/colblk.cpp storage/connect/connect.cc storage/connect/csort.h storage/connect/filamap.cpp storage/connect/filamdbf.cpp storage/connect/filamfix.cpp storage/connect/filamtxt.cpp storage/connect/filamzip.cpp storage/connect/ha_connect.cc storage/connect/mycat.cc storage/connect/myconn.cpp storage/connect/myutil.cpp storage/connect/osutil.c storage/connect/plgdbsem.h storage/connect/plgdbutl.cpp storage/connect/plugutil.c storage/connect/reldef.cpp storage/connect/tabcol.cpp storage/connect/tabfmt.cpp storage/connect/tabmysql.cpp storage/connect/tabodbc.cpp storage/connect/tabpivot.cpp storage/connect/tabvct.cpp storage/connect/user_connect.cc storage/connect/valblk.cpp storage/connect/value.cpp storage/connect/xindex.cpp
This commit is contained in:
@@ -38,10 +38,9 @@ typedef class BLOCK *PBLOCK;
|
|||||||
class DllExport BLOCK {
|
class DllExport BLOCK {
|
||||||
public:
|
public:
|
||||||
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
|
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
|
||||||
#ifdef DEBTRACE
|
// if (trace > 2)
|
||||||
if (debug != NULL)
|
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
|
||||||
htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
|
|
||||||
#endif
|
|
||||||
return (PlugSubAlloc(g, p, size));
|
return (PlugSubAlloc(g, p, size));
|
||||||
} // end of new
|
} // end of new
|
||||||
|
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
#include "xindex.h"
|
#include "xindex.h"
|
||||||
#include "xtable.h"
|
#include "xtable.h"
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* COLBLK protected constructor. */
|
/* COLBLK protected constructor. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -76,9 +78,8 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
|
|||||||
//To_Orig = col1;
|
//To_Orig = col1;
|
||||||
To_Tdb = tdbp;
|
To_Tdb = tdbp;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
|
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tdbp)
|
if (tdbp)
|
||||||
// Attach the new column to the table block
|
// Attach the new column to the table block
|
||||||
@@ -116,10 +117,9 @@ bool COLBLK::SetFormat(PGLOBAL g, FORMAT& fmt)
|
|||||||
{
|
{
|
||||||
fmt = Format;
|
fmt = Format;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("COLBLK: %p format=%c(%d,%d)\n",
|
htrc("COLBLK: %p format=%c(%d,%d)\n",
|
||||||
this, *fmt.Type, fmt.Length, fmt.Prec);
|
this, *fmt.Type, fmt.Length, fmt.Prec);
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // end of SetFormat
|
} // end of SetFormat
|
||||||
@@ -130,9 +130,8 @@ bool COLBLK::SetFormat(PGLOBAL g, FORMAT& fmt)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool COLBLK::Eval(PGLOBAL g)
|
bool COLBLK::Eval(PGLOBAL g)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("Col Eval: %s status=%.4X\n", Name, Status);
|
htrc("Col Eval: %s status=%.4X\n", Name, Status);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!GetStatus(BUF_READ)) {
|
if (!GetStatus(BUF_READ)) {
|
||||||
// if (To_Tdb->IsNull())
|
// if (To_Tdb->IsNull())
|
||||||
@@ -168,10 +167,9 @@ bool COLBLK::InitValue(PGLOBAL g)
|
|||||||
AddStatus(BUF_READY);
|
AddStatus(BUF_READY);
|
||||||
Value->SetNullable(Nullable);
|
Value->SetNullable(Nullable);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
|
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
|
||||||
this, Buf_Type, Value, ColUse, Status);
|
this, Buf_Type, Value, ColUse, Status);
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // end of InitValue
|
} // end of InitValue
|
||||||
|
@@ -51,7 +51,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
extern int xtrace;
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Routines called internally by semantic routines. */
|
/* Routines called internally by semantic routines. */
|
||||||
@@ -110,14 +110,14 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
bool rc= false;
|
bool rc= false;
|
||||||
PDBUSER dbuserp= PlgGetUser(g);
|
PDBUSER dbuserp= PlgGetUser(g);
|
||||||
|
|
||||||
if (xtrace) {
|
if (trace) {
|
||||||
printf("CntCheckDB: dbuserp=%p\n", dbuserp);
|
printf("CntCheckDB: dbuserp=%p\n", dbuserp);
|
||||||
} // endif xtrace
|
} // endif trace
|
||||||
|
|
||||||
if (!dbuserp || !handler)
|
if (!dbuserp || !handler)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
|
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
|
||||||
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
|
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
|
||||||
handler);
|
handler);
|
||||||
@@ -149,7 +149,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
sprintf(g->Message, MSG(DATABASE_LOADED), "???");
|
sprintf(g->Message, MSG(DATABASE_LOADED), "???");
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("msg=%s\n", g->Message);
|
printf("msg=%s\n", g->Message);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -193,7 +193,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
PDBUSER dup= PlgGetUser(g);
|
PDBUSER dup= PlgGetUser(g);
|
||||||
PCATLG cat= (dup) ? dup->Catalog : NULL; // Safe over longjmp
|
PCATLG cat= (dup) ? dup->Catalog : NULL; // Safe over longjmp
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
||||||
|
|
||||||
if (!cat)
|
if (!cat)
|
||||||
@@ -213,7 +213,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
// Get table object from the catalog
|
// Get table object from the catalog
|
||||||
tabp= new(g) XTAB(name);
|
tabp= new(g) XTAB(name);
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("CntGetTDB: tabp=%p\n", tabp);
|
printf("CntGetTDB: tabp=%p\n", tabp);
|
||||||
|
|
||||||
// Perhaps this should be made thread safe
|
// Perhaps this should be made thread safe
|
||||||
@@ -223,7 +223,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
printf("CntGetTDB: %s\n", g->Message);
|
printf("CntGetTDB: %s\n", g->Message);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
||||||
|
|
||||||
g->jump_level--;
|
g->jump_level--;
|
||||||
@@ -243,7 +243,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
//PCOLUMN cp;
|
//PCOLUMN cp;
|
||||||
PDBUSER dup= PlgGetUser(g);
|
PDBUSER dup= PlgGetUser(g);
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
|
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
|
||||||
|
|
||||||
if (!tdbp) {
|
if (!tdbp) {
|
||||||
@@ -269,7 +269,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
|
|
||||||
} else for (p= c1; *p; p+= n) {
|
} else for (p= c1; *p; p+= n) {
|
||||||
// Allocate only used column blocks
|
// Allocate only used column blocks
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("Allocating column %s\n", p);
|
printf("Allocating column %s\n", p);
|
||||||
|
|
||||||
// if (*p == '*') {
|
// if (*p == '*') {
|
||||||
@@ -337,7 +337,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
((PTDBASE)tdbp)->SetSetCols(tdbp->GetColumns());
|
((PTDBASE)tdbp)->SetSetCols(tdbp->GetColumns());
|
||||||
|
|
||||||
// Now do open the physical table
|
// Now do open the physical table
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("Opening table %s in mode %d tdbp=%p\n",
|
printf("Opening table %s in mode %d tdbp=%p\n",
|
||||||
tdbp->GetName(), mode, tdbp);
|
tdbp->GetName(), mode, tdbp);
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
} // endif del
|
} // endif del
|
||||||
|
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("About to open the table: tdbp=%p\n", tdbp);
|
printf("About to open the table: tdbp=%p\n", tdbp);
|
||||||
|
|
||||||
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
||||||
@@ -394,7 +394,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
|
|||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
// Save stack and allocation environment and prepare error return
|
||||||
if (g->jump_level == MAX_JUMP) {
|
if (g->jump_level == MAX_JUMP) {
|
||||||
if (xtrace) {
|
if (trace) {
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
||||||
printf("EvalColumns: %s\n", g->Message);
|
printf("EvalColumns: %s\n", g->Message);
|
||||||
} // endif
|
} // endif
|
||||||
@@ -403,7 +403,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
|
|||||||
} // endif jump_level
|
} // endif jump_level
|
||||||
|
|
||||||
if (setjmp(g->jumper[++g->jump_level]) != 0) {
|
if (setjmp(g->jumper[++g->jump_level]) != 0) {
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("Error reading columns: %s\n", g->Message);
|
printf("Error reading columns: %s\n", g->Message);
|
||||||
|
|
||||||
rc= RC_FX;
|
rc= RC_FX;
|
||||||
@@ -547,7 +547,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
|
|||||||
if (!tdbp || tdbp->GetUse() != USE_OPEN)
|
if (!tdbp || tdbp->GetUse() != USE_OPEN)
|
||||||
return rc; // Nothing to do
|
return rc; // Nothing to do
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("CntCloseTable: tdbp=%p mode=%d\n", tdbp, tdbp->GetMode());
|
printf("CntCloseTable: tdbp=%p mode=%d\n", tdbp, tdbp->GetMode());
|
||||||
|
|
||||||
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN)
|
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN)
|
||||||
@@ -571,7 +571,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
|
|||||||
|
|
||||||
g->jump_level--;
|
g->jump_level--;
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (trace > 1)
|
||||||
printf("Table %s closed\n", tdbp->GetName());
|
printf("Table %s closed\n", tdbp->GetName());
|
||||||
|
|
||||||
//if (!((PTDBDOX)tdbp)->GetModified())
|
//if (!((PTDBDOX)tdbp)->GetModified())
|
||||||
@@ -580,7 +580,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
|
|||||||
if (tdbp->GetMode() == MODE_READ || tdbp->GetMode() == MODE_ANY)
|
if (tdbp->GetMode() == MODE_READ || tdbp->GetMode() == MODE_ANY)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (trace > 1)
|
||||||
printf("About to reset opt\n");
|
printf("About to reset opt\n");
|
||||||
|
|
||||||
// Make all the eventual indexes
|
// Make all the eventual indexes
|
||||||
@@ -590,7 +590,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
|
|||||||
rc= tbxp->ResetTableOpt(g, false, ((PTDBASE)tdbp)->GetDef()->Indexable());
|
rc= tbxp->ResetTableOpt(g, false, ((PTDBASE)tdbp)->GetDef()->Indexable());
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (xtrace > 1)
|
if (trace > 1)
|
||||||
printf("Done rc=%d\n", rc);
|
printf("Done rc=%d\n", rc);
|
||||||
|
|
||||||
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
||||||
@@ -859,10 +859,10 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
} else
|
} else
|
||||||
valp->SetBinValue((void*)p);
|
valp->SetBinValue((void*)p);
|
||||||
|
|
||||||
if (xtrace) {
|
if (trace) {
|
||||||
char bf[32];
|
char bf[32];
|
||||||
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
|
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
|
||||||
} // endif xtrace
|
} // endif trace
|
||||||
|
|
||||||
p+= valp->GetClen();
|
p+= valp->GetClen();
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
|
|
||||||
xbp->SetNval(n);
|
xbp->SetNval(n);
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
|
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
|
||||||
|
|
||||||
k[i]= xbp->Range(g, i + 1, incl[i]);
|
k[i]= xbp->Range(g, i + 1, incl[i]);
|
||||||
@@ -890,7 +890,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("k1=%d k0=%d\n", k[1], k[0]);
|
printf("k1=%d k0=%d\n", k[1], k[0]);
|
||||||
|
|
||||||
return k[1] - k[0];
|
return k[1] - k[0];
|
||||||
|
@@ -22,9 +22,7 @@
|
|||||||
#define THRESH 4 /* Threshold for insertion (was 4) */
|
#define THRESH 4 /* Threshold for insertion (was 4) */
|
||||||
#define MTHRESH 6 /* Threshold for median */
|
#define MTHRESH 6 /* Threshold for median */
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
//extern FILE *debug; /* Debug file */
|
||||||
extern FILE *debug; /* Debug file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int* const CPINT;
|
typedef int* const CPINT;
|
||||||
|
|
||||||
|
@@ -46,6 +46,8 @@
|
|||||||
#include "filamap.h"
|
#include "filamap.h"
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/* --------------------------- Class MAPFAM -------------------------- */
|
/* --------------------------- Class MAPFAM -------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -89,9 +91,8 @@ int MAPFAM::GetFileLength(PGLOBAL g)
|
|||||||
|
|
||||||
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("Mapped file length=%d\n", len);
|
htrc("Mapped file length=%d\n", len);
|
||||||
#endif
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
} // end of GetFileLength
|
} // end of GetFileLength
|
||||||
@@ -166,9 +167,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", (int) rc, filename);
|
"map", (int) rc, filename);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("%s\n", g->Message);
|
htrc("CreateFileMap: %s\n", g->Message);
|
||||||
#endif
|
|
||||||
return (mode == MODE_READ && rc == ENOENT)
|
return (mode == MODE_READ && rc == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif hFile
|
} // endif hFile
|
||||||
@@ -228,10 +229,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
Fpos = Mempos = Memory;
|
Fpos = Mempos = Memory;
|
||||||
Top = Memory + len;
|
Top = Memory + len;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
||||||
fp, fp->Count, Memory, len, Top);
|
fp, fp->Count, Memory, len, Top);
|
||||||
#endif
|
|
||||||
|
|
||||||
return AllocateBuffer(g); // Useful for DBF files
|
return AllocateBuffer(g); // Useful for DBF files
|
||||||
} // end of OpenTableFile
|
} // end of OpenTableFile
|
||||||
@@ -383,20 +383,19 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
fprintf(debug,
|
htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
|
||||||
"MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
|
|
||||||
irc, Mempos, To_Buf, Tpos, Spos);
|
irc, Mempos, To_Buf, Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (irc != RC_OK) {
|
if (irc != RC_OK) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* EOF: position Fpos at the top of map position. */
|
/* EOF: position Fpos at the top of map position. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Top;
|
Fpos = Top;
|
||||||
#ifdef DEBTRACE
|
|
||||||
|
if (trace)
|
||||||
htrc("Fpos placed at file top=%p\n", Fpos);
|
htrc("Fpos placed at file top=%p\n", Fpos);
|
||||||
#endif
|
|
||||||
} // endif irc
|
} // endif irc
|
||||||
|
|
||||||
if (Tpos == Spos)
|
if (Tpos == Spos)
|
||||||
@@ -412,17 +411,16 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
memmove(Tpos, Spos, n);
|
memmove(Tpos, Spos, n);
|
||||||
Tpos += n;
|
Tpos += n;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("move %d bytes\n", n);
|
htrc("move %d bytes\n", n);
|
||||||
#endif
|
|
||||||
} // endif n
|
} // endif n
|
||||||
|
|
||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
Spos = Mempos; // New start position
|
Spos = Mempos; // New start position
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
} else if (To_Fb) { // Can be NULL for deleted files
|
} else if (To_Fb) { // Can be NULL for deleted files
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -450,9 +448,8 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!SetEndOfFile(fp->Handle)) {
|
if (!SetEndOfFile(fp->Handle)) {
|
||||||
sprintf(g->Message, MSG(FUNCTION_ERROR),
|
sprintf(g->Message, MSG(FUNCTION_ERROR),
|
||||||
@@ -484,10 +481,10 @@ void MAPFAM::CloseTableFile(PGLOBAL g)
|
|||||||
PlugCloseFile(g, To_Fb);
|
PlugCloseFile(g, To_Fb);
|
||||||
To_Fb = NULL; // To get correct file size in Cardinality
|
To_Fb = NULL; // To get correct file size in Cardinality
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("MAP Close: closing %s count=%d\n",
|
htrc("MAP Close: closing %s count=%d\n",
|
||||||
To_File, (To_Fb) ? To_Fb->Count : 0);
|
To_File, (To_Fb) ? To_Fb->Count : 0);
|
||||||
#endif
|
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -485,16 +485,15 @@ bool DBFFAM::OpenTableFile(PGLOBAL g)
|
|||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
#endif
|
|
||||||
return (mode == MODE_READ && errno == ENOENT)
|
return (mode == MODE_READ && errno == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif Stream
|
} // endif Stream
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("File %s is open in mode %s\n", filename, opmode);
|
htrc("File %s is open in mode %s\n", filename, opmode);
|
||||||
#endif
|
|
||||||
|
|
||||||
To_Fb = dbuserp->Openlist; // Keep track of File block
|
To_Fb = dbuserp->Openlist; // Keep track of File block
|
||||||
|
|
||||||
@@ -853,10 +852,10 @@ void DBFFAM::CloseTableFile(PGLOBAL g)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
#endif
|
|
||||||
Stream = NULL; // So we can know whether table is open
|
Stream = NULL; // So we can know whether table is open
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
|
|
||||||
|
@@ -52,6 +52,7 @@
|
|||||||
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
|
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
extern int num_read, num_there, num_eq[2]; // Statistics
|
extern int num_read, num_there, num_eq[2]; // Statistics
|
||||||
|
|
||||||
/* --------------------------- Class FIXFAM -------------------------- */
|
/* --------------------------- Class FIXFAM -------------------------- */
|
||||||
@@ -241,9 +242,8 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif fseek
|
} // endif fseek
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("File position is now %d\n", ftell(Stream));
|
htrc("File position is now %d\n", ftell(Stream));
|
||||||
#endif
|
|
||||||
|
|
||||||
//long tell = ftell(Stream); not used
|
//long tell = ftell(Stream); not used
|
||||||
|
|
||||||
@@ -266,9 +266,9 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
|
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
#endif
|
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endelse
|
} // endelse
|
||||||
|
|
||||||
@@ -283,11 +283,9 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int FIXFAM::WriteBuffer(PGLOBAL g)
|
int FIXFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("FIX WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
||||||
"FIX WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
|
||||||
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Tdbp->GetMode() == MODE_INSERT) {
|
if (Tdbp->GetMode() == MODE_INSERT) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -298,9 +296,8 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
return RC_OK; // We write only full blocks
|
return RC_OK; // We write only full blocks
|
||||||
} // endif CurNum
|
} // endif CurNum
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Now start the writing process.
|
// Now start the writing process.
|
||||||
if (fwrite(To_Buf, Lrecl, Rbuf, Stream) != (size_t)Rbuf) {
|
if (fwrite(To_Buf, Lrecl, Rbuf, Stream) != (size_t)Rbuf) {
|
||||||
@@ -313,9 +310,8 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
Tdbp->SetLine(To_Buf);
|
Tdbp->SetLine(To_Buf);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("write done\n");
|
htrc("write done\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
// T_Stream is the temporary stream or the table file stream itself
|
// T_Stream is the temporary stream or the table file stream itself
|
||||||
@@ -353,20 +349,19 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/* This will be experimented. */
|
/* This will be experimented. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
"DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (irc != RC_OK) {
|
if (irc != RC_OK) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* EOF: position Fpos at the end-of-file position. */
|
/* EOF: position Fpos at the end-of-file position. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Tdbp->Cardinality(g);
|
Fpos = Tdbp->Cardinality(g);
|
||||||
#ifdef DEBTRACE
|
|
||||||
|
if (trace > 1)
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
#endif
|
|
||||||
} else // Fpos is the deleted line position
|
} else // Fpos is the deleted line position
|
||||||
Fpos = CurBlk * Nrec + CurNum;
|
Fpos = CurBlk * Nrec + CurNum;
|
||||||
|
|
||||||
@@ -414,9 +409,8 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
OldBlk = -2; // To force fseek to be executed on next block
|
OldBlk = -2; // To force fseek to be executed on next block
|
||||||
} // endif moved
|
} // endif moved
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -464,9 +458,9 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
close(h);
|
close(h);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("done, h=%d irc=%d\n", h, irc);
|
htrc("done, h=%d irc=%d\n", h, irc);
|
||||||
#endif
|
|
||||||
} // endif UseTemp
|
} // endif UseTemp
|
||||||
|
|
||||||
} // endif irc
|
} // endif irc
|
||||||
@@ -496,9 +490,8 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
req = (size_t)min(n, Dbflen);
|
req = (size_t)min(n, Dbflen);
|
||||||
len = fread(DelBuf, Lrecl, req, Stream);
|
len = fread(DelBuf, Lrecl, req, Stream);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
||||||
@@ -516,16 +509,14 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after write pos=%d\n", ftell(Stream));
|
htrc("after write pos=%d\n", ftell(Stream));
|
||||||
#endif
|
|
||||||
|
|
||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
*b = true;
|
*b = true;
|
||||||
} // endfor n
|
} // endfor n
|
||||||
@@ -574,10 +565,10 @@ void FIXFAM::CloseTableFile(PGLOBAL g)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
#endif
|
|
||||||
Stream = NULL; // So we can know whether table is open
|
Stream = NULL; // So we can know whether table is open
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
|
|
||||||
@@ -641,9 +632,8 @@ int BGXFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
DWORD nbr, drc, len = (DWORD)req;
|
DWORD nbr, drc, len = (DWORD)req;
|
||||||
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!brc) {
|
if (!brc) {
|
||||||
char buf[256]; // , *fn = (h == Hfile) ? To_File : "Tempfile";
|
char buf[256]; // , *fn = (h == Hfile) ? To_File : "Tempfile";
|
||||||
@@ -653,9 +643,10 @@ int BGXFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0,
|
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0,
|
||||||
(LPTSTR)buf, sizeof(buf), NULL);
|
(LPTSTR)buf, sizeof(buf), NULL);
|
||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
||||||
#ifdef DEBTRACE
|
|
||||||
|
if (trace > 1)
|
||||||
htrc("BIGREAD: %s\n", g->Message);
|
htrc("BIGREAD: %s\n", g->Message);
|
||||||
#endif
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
} else
|
} else
|
||||||
rc = (int)nbr;
|
rc = (int)nbr;
|
||||||
@@ -680,9 +671,8 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
DWORD nbw, drc, len = (DWORD)req;
|
DWORD nbw, drc, len = (DWORD)req;
|
||||||
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!brc || nbw != len) {
|
if (!brc || nbw != len) {
|
||||||
char buf[256], *fn = (h == Hfile) ? To_File : "Tempfile";
|
char buf[256], *fn = (h == Hfile) ? To_File : "Tempfile";
|
||||||
@@ -698,10 +688,10 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, drc, g->Message);
|
nbw, len, drc, g->Message);
|
||||||
#endif
|
|
||||||
rc = true;
|
rc = true;
|
||||||
} // endif brc || nbw
|
} // endif brc || nbw
|
||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
@@ -712,10 +702,11 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
const char *fn = (h == Hfile) ? To_File : "Tempfile";
|
const char *fn = (h == Hfile) ? To_File : "Tempfile";
|
||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
||||||
#ifdef DEBTRACE
|
|
||||||
|
if (trace > 1)
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, errno, g->Message);
|
nbw, len, errno, g->Message);
|
||||||
#endif
|
|
||||||
rc = true;
|
rc = true;
|
||||||
} // endif nbr
|
} // endif nbr
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
@@ -750,9 +741,8 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
|
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
DWORD rc, access, creation, share = 0;
|
DWORD rc, access, creation, share = 0;
|
||||||
@@ -811,11 +801,9 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
||||||
" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
|
||||||
rc, access, share, creation, Hfile, filename);
|
rc, access, share, creation, Hfile, filename);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mode == MODE_INSERT)
|
if (mode == MODE_INSERT)
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -866,10 +854,9 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
|
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
|
||||||
rc, oflag, tmode, Hfile, filename);
|
rc, oflag, tmode, Hfile, filename);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
|
|
||||||
@@ -951,14 +938,13 @@ int BGXFAM::Cardinality(PGLOBAL g)
|
|||||||
if (Hfile == INVALID_HANDLE_VALUE) {
|
if (Hfile == INVALID_HANDLE_VALUE) {
|
||||||
int h = open64(filename, O_RDONLY, 0);
|
int h = open64(filename, O_RDONLY, 0);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" h=%d\n", h);
|
htrc(" h=%d\n", h);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
|
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
|
||||||
#endif
|
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
sprintf(g->Message, MSG(OPEN_ERROR_IS),
|
sprintf(g->Message, MSG(OPEN_ERROR_IS),
|
||||||
filename, strerror(errno));
|
filename, strerror(errno));
|
||||||
@@ -1000,10 +986,9 @@ int BGXFAM::Cardinality(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
|
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
|
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
|
||||||
card, (double)fsize, Lrecl);
|
card, (double)fsize, Lrecl);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set number of blocks for later use
|
// Set number of blocks for later use
|
||||||
Block = (card + Nrec - 1) / Nrec;
|
Block = (card + Nrec - 1) / Nrec;
|
||||||
@@ -1101,9 +1086,8 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
|
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("File position is now %d\n", Fpos);
|
htrc("File position is now %d\n", Fpos);
|
||||||
#endif
|
|
||||||
|
|
||||||
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
|
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
|
||||||
|
|
||||||
@@ -1126,11 +1110,9 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BGXFAM::WriteBuffer(PGLOBAL g)
|
int BGXFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("BIG WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
||||||
"BIG WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
|
||||||
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Tdbp->GetMode() == MODE_INSERT) {
|
if (Tdbp->GetMode() == MODE_INSERT) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -1141,9 +1123,8 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
return RC_OK; // We write only full blocks
|
return RC_OK; // We write only full blocks
|
||||||
} // endif CurNum
|
} // endif CurNum
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Now start the writing process.
|
// Now start the writing process.
|
||||||
if (BigWrite(g, Hfile, To_Buf, Lrecl * Rbuf))
|
if (BigWrite(g, Hfile, To_Buf, Lrecl * Rbuf))
|
||||||
@@ -1153,9 +1134,8 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
Tdbp->SetLine(To_Buf);
|
Tdbp->SetLine(To_Buf);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("write done\n");
|
htrc("write done\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
// Tfile is the temporary file or the table file handle itself
|
// Tfile is the temporary file or the table file handle itself
|
||||||
@@ -1190,20 +1170,19 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/* This will be experimented. */
|
/* This will be experimented. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
"BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (irc != RC_OK) {
|
if (irc != RC_OK) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* EOF: position Fpos at the end-of-file position. */
|
/* EOF: position Fpos at the end-of-file position. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Tdbp->Cardinality(g);
|
Fpos = Tdbp->Cardinality(g);
|
||||||
#ifdef DEBTRACE
|
|
||||||
|
if (trace > 1)
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
#endif
|
|
||||||
} else // Fpos is the deleted line position
|
} else // Fpos is the deleted line position
|
||||||
Fpos = CurBlk * Nrec + CurNum;
|
Fpos = CurBlk * Nrec + CurNum;
|
||||||
|
|
||||||
@@ -1239,9 +1218,9 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
assert(Spos == Fpos);
|
assert(Spos == Fpos);
|
||||||
#endif
|
|
||||||
Spos++; // New start position is on next line
|
Spos++; // New start position is on next line
|
||||||
|
|
||||||
if (moved) {
|
if (moved) {
|
||||||
@@ -1251,9 +1230,8 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
OldBlk = -2; // To force fseek to be executed on next block
|
OldBlk = -2; // To force fseek to be executed on next block
|
||||||
} // endif moved
|
} // endif moved
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -1385,9 +1363,8 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
#endif
|
|
||||||
|
|
||||||
*b = true;
|
*b = true;
|
||||||
} // endfor n
|
} // endfor n
|
||||||
@@ -1435,10 +1412,10 @@ void BGXFAM::CloseTableFile(PGLOBAL g)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
#endif
|
|
||||||
Hfile = INVALID_HANDLE_VALUE; // So we can know whether table is open
|
Hfile = INVALID_HANDLE_VALUE; // So we can know whether table is open
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
|
|
||||||
|
@@ -555,7 +555,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
|
htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
|
||||||
|
|
||||||
/*******************************************************************/
|
/********************************************************************/
|
||||||
/* Check whether optimization on ROWID */
|
/* Check whether optimization on ROWID */
|
||||||
/* can be done, as well as for join as for local filtering. */
|
/* can be done, as well as for join as for local filtering. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -995,7 +995,9 @@ void DOSFAM::CloseTableFile(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void DOSFAM::Rewind(void)
|
void DOSFAM::Rewind(void)
|
||||||
{
|
{
|
||||||
|
if (Stream) // Can be NULL when making index on void table
|
||||||
rewind(Stream);
|
rewind(Stream);
|
||||||
|
|
||||||
Rows = 0;
|
Rows = 0;
|
||||||
OldBlk = CurBlk = -1;
|
OldBlk = CurBlk = -1;
|
||||||
} // end of Rewind
|
} // end of Rewind
|
||||||
|
@@ -62,6 +62,7 @@
|
|||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
extern int num_read, num_there, num_eq[]; // Statistics
|
extern int num_read, num_there, num_eq[]; // Statistics
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
@@ -203,9 +204,8 @@ bool ZIPFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
Buflen = Lrecl + 2; // Lrecl does not include CRLF
|
Buflen = Lrecl + 2; // Lrecl does not include CRLF
|
||||||
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
|
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
||||||
#endif
|
|
||||||
|
|
||||||
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
||||||
|
|
||||||
@@ -348,9 +348,9 @@ int ZIPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = Zerror(g);
|
rc = Zerror(g);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
|
htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
|
||||||
#endif
|
|
||||||
return rc;
|
return rc;
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
@@ -390,9 +390,8 @@ void ZIPFAM::CloseTableFile(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
int rc = gzclose(Zfile);
|
int rc = gzclose(Zfile);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
#endif
|
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||||
@@ -708,9 +707,8 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = gzclose(Zfile);
|
rc = gzclose(Zfile);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
#endif
|
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||||
@@ -1365,10 +1363,9 @@ void ZLBFAM::CloseTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = fclose(Stream);
|
rc = fclose(Stream);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
|
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
|
||||||
To_File, Tdbp->GetMode(), rc);
|
To_File, Tdbp->GetMode(), rc);
|
||||||
#endif
|
|
||||||
|
|
||||||
Stream = NULL; // So we can know whether table is open
|
Stream = NULL; // So we can know whether table is open
|
||||||
To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||||
|
@@ -143,34 +143,22 @@
|
|||||||
#include "myutil.h"
|
#include "myutil.h"
|
||||||
#include "preparse.h"
|
#include "preparse.h"
|
||||||
#include "inihandl.h"
|
#include "inihandl.h"
|
||||||
|
#if defined(LIBXML2_SUPPORT)
|
||||||
|
#include "libdoc.h"
|
||||||
|
#endif // LIBXML2_SUPPORT
|
||||||
|
#include "taboccur.h"
|
||||||
|
#include "tabpivot.h"
|
||||||
|
|
||||||
#define PLGXINI "plgcnx.ini" /* Configuration settings file */
|
|
||||||
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
|
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
|
||||||
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
|
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
|
||||||
#define my_stricmp(a,b) my_strcasecmp(default_charset_info, (a), (b))
|
#define my_stricmp(a,b) my_strcasecmp(default_charset_info, (a), (b))
|
||||||
|
|
||||||
#ifdef LIBXML2_SUPPORT
|
|
||||||
#include "libdoc.h"
|
|
||||||
#endif // LIBXML2_SUPPORT
|
|
||||||
|
|
||||||
#include "taboccur.h"
|
|
||||||
#include "tabpivot.h"
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* DB static variables. */
|
|
||||||
/***********************************************************************/
|
|
||||||
extern "C" char plgxini[];
|
|
||||||
extern "C" char plgini[];
|
|
||||||
extern "C" char nmfile[];
|
|
||||||
extern "C" char pdebug[];
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Initialize the ha_connect static members. */
|
/* Initialize the ha_connect static members. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#define CONNECT_INI "connect.ini"
|
//efine CONNECT_INI "connect.ini"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char connectini[_MAX_PATH]= CONNECT_INI;
|
|
||||||
char version[]= "Version 1.02.0001 February 03, 2014";
|
char version[]= "Version 1.02.0001 February 03, 2014";
|
||||||
|
|
||||||
#if defined(XMSG)
|
#if defined(XMSG)
|
||||||
@@ -179,7 +167,8 @@ extern "C" {
|
|||||||
int trace= 0; // The general trace value
|
int trace= 0; // The general trace value
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
int xtrace= 0;
|
static int xtrace= 0;
|
||||||
|
|
||||||
ulong ha_connect::num= 0;
|
ulong ha_connect::num= 0;
|
||||||
//int DTVAL::Shift= 0;
|
//int DTVAL::Shift= 0;
|
||||||
|
|
||||||
@@ -199,6 +188,14 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||||||
TABLE_SHARE *table_s,
|
TABLE_SHARE *table_s,
|
||||||
HA_CREATE_INFO *info);
|
HA_CREATE_INFO *info);
|
||||||
|
|
||||||
|
static void update_connect_xtrace(MYSQL_THD thd,
|
||||||
|
struct st_mysql_sys_var *var,
|
||||||
|
void *var_ptr, const void *save)
|
||||||
|
{
|
||||||
|
xtrace= *(int *)save;
|
||||||
|
//xtrace= *(int *)var_ptr= *(int *)save;
|
||||||
|
} // end of update_connect_xtrace
|
||||||
|
|
||||||
handlerton *connect_hton;
|
handlerton *connect_hton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,32 +339,16 @@ static const char *ha_connect_exts[]= {
|
|||||||
static int connect_init_func(void *p)
|
static int connect_init_func(void *p)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("connect_init_func");
|
DBUG_ENTER("connect_init_func");
|
||||||
char dir[_MAX_PATH - sizeof(CONNECT_INI) - 1];
|
|
||||||
|
sql_print_information("CONNECT: %s", version);
|
||||||
|
|
||||||
|
// xtrace is now a system variable
|
||||||
|
trace= xtrace;
|
||||||
|
|
||||||
#ifdef LIBXML2_SUPPORT
|
#ifdef LIBXML2_SUPPORT
|
||||||
XmlInitParserLib();
|
XmlInitParserLib();
|
||||||
#endif // LIBXML2_SUPPORT
|
#endif // LIBXML2_SUPPORT
|
||||||
|
|
||||||
/* Build connect.ini file name */
|
|
||||||
my_getwd(dir, sizeof(dir) - 1, MYF(0));
|
|
||||||
snprintf(connectini, sizeof(connectini), "%s%s", dir, CONNECT_INI);
|
|
||||||
sql_print_information("CONNECT: %s=%s", CONNECT_INI, connectini);
|
|
||||||
|
|
||||||
if ((xtrace= GetPrivateProfileInt("CONNECT", "Trace", 0, connectini)))
|
|
||||||
{
|
|
||||||
sql_print_information("CONNECT: xtrace=%d", xtrace);
|
|
||||||
sql_print_information("CONNECT: plgini=%s", plgini);
|
|
||||||
sql_print_information("CONNECT: plgxini=%s", plgxini);
|
|
||||||
sql_print_information("CONNECT: nmfile=%s", nmfile);
|
|
||||||
sql_print_information("CONNECT: pdebug=%s", pdebug);
|
|
||||||
sql_print_information("CONNECT: version=%s", version);
|
|
||||||
trace= xtrace;
|
|
||||||
} // endif xtrace
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
PROFILE_Close(connectini);
|
|
||||||
#endif // !WIN32
|
|
||||||
|
|
||||||
init_connect_psi_keys();
|
init_connect_psi_keys();
|
||||||
|
|
||||||
connect_hton= (handlerton *)p;
|
connect_hton= (handlerton *)p;
|
||||||
@@ -402,7 +383,7 @@ static int connect_done_func(void *p)
|
|||||||
#endif // LIBXML2_SUPPORT
|
#endif // LIBXML2_SUPPORT
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
PROFILE_End();
|
//PROFILE_End(); Causes signal 11
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
for (pc= user_connect::to_users; pc; pc= pn) {
|
for (pc= user_connect::to_users; pc; pc= pn) {
|
||||||
@@ -595,6 +576,7 @@ ulonglong ha_connect::table_flags() const
|
|||||||
ulonglong flags= HA_CAN_VIRTUAL_COLUMNS | HA_REC_NOT_IN_SEQ |
|
ulonglong flags= HA_CAN_VIRTUAL_COLUMNS | HA_REC_NOT_IN_SEQ |
|
||||||
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
|
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
|
||||||
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
|
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
|
||||||
|
HA_PARTIAL_COLUMN_READ |
|
||||||
// HA_NULL_IN_KEY | not implemented yet
|
// HA_NULL_IN_KEY | not implemented yet
|
||||||
// HA_FAST_KEY_READ | causes error when sorting (???)
|
// HA_FAST_KEY_READ | causes error when sorting (???)
|
||||||
HA_NO_TRANSACTIONS | HA_DUPLICATE_KEY_NOT_IN_ORDER |
|
HA_NO_TRANSACTIONS | HA_DUPLICATE_KEY_NOT_IN_ORDER |
|
||||||
@@ -972,7 +954,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
|||||||
break;
|
break;
|
||||||
case TYPE_DATE:
|
case TYPE_DATE:
|
||||||
// Field_length is only used for DATE columns
|
// Field_length is only used for DATE columns
|
||||||
if (fop->fldlen)
|
if (fop && fop->fldlen)
|
||||||
pcf->Length= (int)fop->fldlen;
|
pcf->Length= (int)fop->fldlen;
|
||||||
else {
|
else {
|
||||||
int len;
|
int len;
|
||||||
@@ -3938,7 +3920,7 @@ static bool add_field(String *sql, const char *field_name, int typ,
|
|||||||
error|= sql->append("` ");
|
error|= sql->append("` ");
|
||||||
error|= sql->append(type);
|
error|= sql->append(type);
|
||||||
|
|
||||||
if (len) {
|
if (len && typ != TYPE_DATE) {
|
||||||
error|= sql->append('(');
|
error|= sql->append('(');
|
||||||
error|= sql->append_ulonglong(len);
|
error|= sql->append_ulonglong(len);
|
||||||
|
|
||||||
@@ -4600,6 +4582,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||||||
len= crp->Length;
|
len= crp->Length;
|
||||||
dec= crp->Prec;
|
dec= crp->Prec;
|
||||||
flg= crp->Flag;
|
flg= crp->Flag;
|
||||||
|
v= crp->Var;
|
||||||
|
|
||||||
if (!len && typ == TYPE_STRING)
|
if (!len && typ == TYPE_STRING)
|
||||||
len= 256; // STRBLK's have 0 length
|
len= 256; // STRBLK's have 0 length
|
||||||
@@ -4607,11 +4590,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||||||
#if defined(NEW_WAY)
|
#if defined(NEW_WAY)
|
||||||
// Now add the field
|
// Now add the field
|
||||||
rc= add_fields(g, thd, &alter_info, cnm, typ, len, dec,
|
rc= add_fields(g, thd, &alter_info, cnm, typ, len, dec,
|
||||||
NOT_NULL_FLAG, "", flg, dbf, 0);
|
NOT_NULL_FLAG, "", flg, dbf, v);
|
||||||
#else // !NEW_WAY
|
#else // !NEW_WAY
|
||||||
// Now add the field
|
// Now add the field
|
||||||
if (add_field(&sql, cnm, typ, len, dec, NOT_NULL_FLAG,
|
if (add_field(&sql, cnm, typ, len, dec, NOT_NULL_FLAG,
|
||||||
NULL, NULL, NULL, flg, dbf, 0))
|
NULL, NULL, NULL, flg, dbf, v))
|
||||||
rc= HA_ERR_OUT_OF_MEM;
|
rc= HA_ERR_OUT_OF_MEM;
|
||||||
#endif // !NEW_WAY
|
#endif // !NEW_WAY
|
||||||
} // endfor crp
|
} // endfor crp
|
||||||
@@ -5002,15 +4985,23 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
case MYSQL_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case MYSQL_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
case MYSQL_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
case MYSQL_TYPE_VARCHAR:
|
|
||||||
case MYSQL_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
case MYSQL_TYPE_TINY:
|
case MYSQL_TYPE_TINY:
|
||||||
break; // Ok
|
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
|
||||||
case MYSQL_TYPE_STRING:
|
|
||||||
case MYSQL_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
case MYSQL_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
|
break; // Ok
|
||||||
|
case MYSQL_TYPE_VARCHAR:
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
case MYSQL_TYPE_STRING:
|
||||||
|
if (!fp->field_length) {
|
||||||
|
sprintf(g->Message, "Unsupported 0 length for column %s",
|
||||||
|
fp->field_name);
|
||||||
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
|
my_printf_error(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
|
DBUG_RETURN(rc);
|
||||||
|
} // endif fp
|
||||||
|
|
||||||
break; // To be checked
|
break; // To be checked
|
||||||
case MYSQL_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
case MYSQL_TYPE_NULL:
|
case MYSQL_TYPE_NULL:
|
||||||
@@ -5026,9 +5017,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
sprintf(g->Message, "Unsupported type for column %s",
|
sprintf(g->Message, "Unsupported type for column %s",
|
||||||
fp->field_name);
|
fp->field_name);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
my_printf_error(ER_UNKNOWN_ERROR,
|
my_printf_error(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
"Unsupported type for column '%s'",
|
|
||||||
MYF(0), fp->field_name);
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
break;
|
break;
|
||||||
} // endswitch type
|
} // endswitch type
|
||||||
@@ -5669,6 +5658,15 @@ Item *ha_connect::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
|
|||||||
struct st_mysql_storage_engine connect_storage_engine=
|
struct st_mysql_storage_engine connect_storage_engine=
|
||||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||||
|
|
||||||
|
static MYSQL_SYSVAR_INT(xtrace, xtrace,
|
||||||
|
PLUGIN_VAR_RQCMDARG, "Console trace value.",
|
||||||
|
NULL, update_connect_xtrace, 0, 0, INT_MAX, 1);
|
||||||
|
|
||||||
|
static struct st_mysql_sys_var* connect_system_variables[]= {
|
||||||
|
MYSQL_SYSVAR(xtrace),
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
maria_declare_plugin(connect)
|
maria_declare_plugin(connect)
|
||||||
{
|
{
|
||||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
MYSQL_STORAGE_ENGINE_PLUGIN,
|
||||||
@@ -5681,7 +5679,7 @@ maria_declare_plugin(connect)
|
|||||||
connect_done_func, /* Plugin Deinit */
|
connect_done_func, /* Plugin Deinit */
|
||||||
0x0103, /* version number (1.03) */
|
0x0103, /* version number (1.03) */
|
||||||
NULL, /* status variables */
|
NULL, /* status variables */
|
||||||
NULL, /* system variables */
|
connect_system_variables, /* system variables */
|
||||||
"1.03", /* string version */
|
"1.03", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
|
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,7 @@
|
|||||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
extern int xtrace;
|
extern "C" int trace;
|
||||||
|
|
||||||
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
|
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ bool MYCAT::GetIndexInfo(PGLOBAL g, PTABDEF defp)
|
|||||||
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name,
|
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name,
|
||||||
LPCSTR type, PRELDEF *prp)
|
LPCSTR type, PRELDEF *prp)
|
||||||
{
|
{
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("GetTableDesc: name=%s am=%s\n", name, SVP(type));
|
printf("GetTableDesc: name=%s am=%s\n", name, SVP(type));
|
||||||
|
|
||||||
// If not specified get the type of this table
|
// If not specified get the type of this table
|
||||||
@@ -735,7 +735,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
|
|||||||
TABTYPE tc;
|
TABTYPE tc;
|
||||||
PRELDEF tdp= NULL;
|
PRELDEF tdp= NULL;
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("MakeTableDesc: name=%s am=%s\n", name, SVP(am));
|
printf("MakeTableDesc: name=%s am=%s\n", name, SVP(am));
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -794,14 +794,14 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
|
|||||||
PTDB tdbp= NULL;
|
PTDB tdbp= NULL;
|
||||||
LPCSTR name= tablep->GetName();
|
LPCSTR name= tablep->GetName();
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("GetTableDB: name=%s\n", name);
|
printf("GetTableDB: name=%s\n", name);
|
||||||
|
|
||||||
// Look for the description of the requested table
|
// Look for the description of the requested table
|
||||||
tdp= GetTableDesc(g, name, type);
|
tdp= GetTableDesc(g, name, type);
|
||||||
|
|
||||||
if (tdp) {
|
if (tdp) {
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("tdb=%p type=%s\n", tdp, tdp->GetType());
|
printf("tdb=%p type=%s\n", tdp, tdp->GetType());
|
||||||
|
|
||||||
if (tablep->GetQualifier())
|
if (tablep->GetQualifier())
|
||||||
@@ -811,7 +811,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
|
|||||||
} // endif tdp
|
} // endif tdp
|
||||||
|
|
||||||
if (tdbp) {
|
if (tdbp) {
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(),
|
printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(),
|
||||||
tdbp->GetAmType());
|
tdbp->GetAmType());
|
||||||
tablep->SetTo_Tdb(tdbp);
|
tablep->SetTo_Tdb(tdbp);
|
||||||
|
@@ -295,7 +295,7 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db,
|
|||||||
|
|
||||||
// Send the source command to MySQL
|
// Send the source command to MySQL
|
||||||
if (myc.ExecSQL(g, query, &w) == RC_OK)
|
if (myc.ExecSQL(g, query, &w) == RC_OK)
|
||||||
qrp = myc.GetResult(g);
|
qrp = myc.GetResult(g, true);
|
||||||
|
|
||||||
myc.Close();
|
myc.Close();
|
||||||
return qrp;
|
return qrp;
|
||||||
@@ -676,7 +676,7 @@ MYSQL_FIELD *MYSQLC::GetNextField(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
||||||
{
|
{
|
||||||
char *fmt;
|
char *fmt, v;
|
||||||
int n;
|
int n;
|
||||||
bool uns;
|
bool uns;
|
||||||
PCOLRES *pcrp, crp;
|
PCOLRES *pcrp, crp;
|
||||||
@@ -705,7 +705,6 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
|||||||
qrp->Nblin = 0;
|
qrp->Nblin = 0;
|
||||||
qrp->Cursor = 0;
|
qrp->Cursor = 0;
|
||||||
|
|
||||||
|
|
||||||
//for (fld = mysql_fetch_field(m_Res); fld;
|
//for (fld = mysql_fetch_field(m_Res); fld;
|
||||||
// fld = mysql_fetch_field(m_Res)) {
|
// fld = mysql_fetch_field(m_Res)) {
|
||||||
for (fld = GetNextField(); fld; fld = GetNextField()) {
|
for (fld = GetNextField(); fld; fld = GetNextField()) {
|
||||||
@@ -718,17 +717,19 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
|||||||
crp->Name = (char*)PlugSubAlloc(g, NULL, fld->name_length + 1);
|
crp->Name = (char*)PlugSubAlloc(g, NULL, fld->name_length + 1);
|
||||||
strcpy(crp->Name, fld->name);
|
strcpy(crp->Name, fld->name);
|
||||||
|
|
||||||
if ((crp->Type = MYSQLtoPLG(fld->type)) == TYPE_ERROR) {
|
if ((crp->Type = MYSQLtoPLG(fld->type, &v)) == TYPE_ERROR) {
|
||||||
sprintf(g->Message, "Type %d not supported for column %s",
|
sprintf(g->Message, "Type %d not supported for column %s",
|
||||||
fld->type, crp->Name);
|
fld->type, crp->Name);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (crp->Type == TYPE_DATE && !pdb)
|
} else if (crp->Type == TYPE_DATE && !pdb)
|
||||||
// For direct MySQL connection, display the MySQL date string
|
// For direct MySQL connection, display the MySQL date string
|
||||||
crp->Type = TYPE_STRING;
|
crp->Type = TYPE_STRING;
|
||||||
|
else
|
||||||
|
crp->Var = v;
|
||||||
|
|
||||||
crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM)
|
crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM)
|
||||||
? fld->decimals : 0;
|
? fld->decimals : 0;
|
||||||
crp->Length = fld->max_length;
|
crp->Length = max(fld->length, fld->max_length);
|
||||||
crp->Clen = GetTypeSize(crp->Type, crp->Length);
|
crp->Clen = GetTypeSize(crp->Type, crp->Length);
|
||||||
uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false;
|
uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false;
|
||||||
|
|
||||||
|
@@ -58,12 +58,8 @@ int MYSQLtoPLG(char *typname, char *var)
|
|||||||
type = TYPE_ERROR;
|
type = TYPE_ERROR;
|
||||||
|
|
||||||
if (var) {
|
if (var) {
|
||||||
// This is to make the difference between CHAR and VARCHAR
|
|
||||||
if (type == TYPE_STRING && stricmp(typname, "char"))
|
|
||||||
*var = 'V';
|
|
||||||
|
|
||||||
// This is to make the difference between temporal values
|
|
||||||
if (type == TYPE_DATE) {
|
if (type == TYPE_DATE) {
|
||||||
|
// This is to make the difference between temporal values
|
||||||
if (!stricmp(typname, "date"))
|
if (!stricmp(typname, "date"))
|
||||||
*var = 'D';
|
*var = 'D';
|
||||||
else if (!stricmp(typname, "datetime"))
|
else if (!stricmp(typname, "datetime"))
|
||||||
@@ -75,7 +71,11 @@ int MYSQLtoPLG(char *typname, char *var)
|
|||||||
else if (!stricmp(typname, "year"))
|
else if (!stricmp(typname, "year"))
|
||||||
*var = 'Y';
|
*var = 'Y';
|
||||||
|
|
||||||
} // endif type
|
} else if (type == TYPE_STRING && stricmp(typname, "char"))
|
||||||
|
// This is to make the difference between CHAR and VARCHAR
|
||||||
|
*var = 'V';
|
||||||
|
else
|
||||||
|
*var = 0;
|
||||||
|
|
||||||
} // endif var
|
} // endif var
|
||||||
|
|
||||||
@@ -200,7 +200,6 @@ int MYSQLtoPLG(int mytype, char *var)
|
|||||||
case MYSQL_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
case MYSQL_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
if (var) *var = 'V';
|
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
type = TYPE_STRING;
|
type = TYPE_STRING;
|
||||||
break;
|
break;
|
||||||
@@ -208,6 +207,25 @@ int MYSQLtoPLG(int mytype, char *var)
|
|||||||
type = TYPE_ERROR;
|
type = TYPE_ERROR;
|
||||||
} // endswitch mytype
|
} // endswitch mytype
|
||||||
|
|
||||||
|
if (var) switch (mytype) {
|
||||||
|
// This is to make the difference between CHAR and VARCHAR
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
#if !defined(ALPHA)
|
||||||
|
case MYSQL_TYPE_VARCHAR:
|
||||||
|
#endif // !ALPHA)
|
||||||
|
case MYSQL_TYPE_BLOB:
|
||||||
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
case MYSQL_TYPE_LONG_BLOB: *var = 'V'; break;
|
||||||
|
// This is to make the difference between temporal values
|
||||||
|
case MYSQL_TYPE_TIMESTAMP: *var = 'S'; break;
|
||||||
|
case MYSQL_TYPE_DATE: *var = 'D'; break;
|
||||||
|
case MYSQL_TYPE_DATETIME: *var = 'A'; break;
|
||||||
|
case MYSQL_TYPE_YEAR: *var = 'Y'; break;
|
||||||
|
case MYSQL_TYPE_TIME: *var = 'T'; break;
|
||||||
|
default: *var = 0;
|
||||||
|
} // endswitch mytype
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
} // end of MYSQLtoPLG
|
} // end of MYSQLtoPLG
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ void _splitpath(LPCSTR name, LPSTR drive, LPSTR dir, LPSTR fn, LPSTR ft)
|
|||||||
LPCSTR p2, p = name;
|
LPCSTR p2, p = name;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
fprintf(debug,"SplitPath: name=%s [%s (%d)]\n",
|
htrc("SplitPath: name=%s [%s (%d)]\n",
|
||||||
XSTR(name), XSTR(__FILE__), __LINE__);
|
XSTR(name), XSTR(__FILE__), __LINE__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ void _splitpath(LPCSTR name, LPSTR drive, LPSTR dir, LPSTR fn, LPSTR ft)
|
|||||||
if (fn) strcpy(fn, p);
|
if (fn) strcpy(fn, p);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
fprintf(debug,"SplitPath: name=%s drive=%s dir=%s filename=%s type=%s [%s(%d)]\n",
|
htrc("SplitPath: name=%s drive=%s dir=%s filename=%s type=%s [%s(%d)]\n",
|
||||||
XSTR(name), XSTR(drive), XSTR(dir), XSTR(fn), XSTR(ft), __FILE__, __LINE__);
|
XSTR(name), XSTR(drive), XSTR(dir), XSTR(fn), XSTR(ft), __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
} /* end of _splitpath */
|
} /* end of _splitpath */
|
||||||
|
@@ -531,6 +531,7 @@ typedef struct _colres {
|
|||||||
int Prec; /* Precision */
|
int Prec; /* Precision */
|
||||||
int Flag; /* Flag option value */
|
int Flag; /* Flag option value */
|
||||||
XFLD Fld; /* Type of field info */
|
XFLD Fld; /* Type of field info */
|
||||||
|
char Var; /* Type added information */
|
||||||
} COLRES;
|
} COLRES;
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(NOEX)
|
#if defined(WIN32) && !defined(NOEX)
|
||||||
|
@@ -80,9 +80,6 @@ extern pthread_mutex_t parmut;
|
|||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
#endif // THREAD
|
#endif // THREAD
|
||||||
|
|
||||||
#define PLGINI "plugdb.ini" /* Configuration settings file */
|
|
||||||
#define PLGXINI "plgcnx.ini" /* Configuration settings file */
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -90,27 +87,13 @@ bool Initdone = false;
|
|||||||
bool plugin = false; // True when called by the XDB plugin handler
|
bool plugin = false; // True when called by the XDB plugin handler
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern char connectini[];
|
|
||||||
char plgxini[_MAX_PATH] = PLGXINI;
|
|
||||||
char plgini[_MAX_PATH] = PLGINI;
|
|
||||||
#if defined(WIN32)
|
|
||||||
char nmfile[_MAX_PATH] = ".\\Log\\plugdb.out";
|
|
||||||
char pdebug[_MAX_PATH] = ".\\Log\\plgthread.out";
|
|
||||||
|
|
||||||
HINSTANCE s_hModule; // Saved module handle
|
|
||||||
#else // !WIN32
|
|
||||||
char nmfile[_MAX_PATH] = "./Log/plugdb.out";
|
|
||||||
char pdebug[_MAX_PATH] = "./Log/plgthread.out";
|
|
||||||
#endif // !WIN32
|
|
||||||
|
|
||||||
#if defined(XMSG)
|
#if defined(XMSG)
|
||||||
char msglang[16] = "ENGLISH"; // Default language
|
char msglang[16] = "ENGLISH"; // Default language
|
||||||
#endif
|
#endif
|
||||||
|
extern int trace;
|
||||||
|
extern char version[];
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
extern "C" int trace;
|
|
||||||
extern "C" char version[];
|
|
||||||
|
|
||||||
// The debug trace used by the main thread
|
// The debug trace used by the main thread
|
||||||
FILE *pfile = NULL;
|
FILE *pfile = NULL;
|
||||||
|
|
||||||
@@ -219,27 +202,6 @@ int global_open(GLOBAL *g, int msgid, const char *path, int flags, int mode)
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Utility for external callers (such as XDB) */
|
|
||||||
/**************************************************************************/
|
|
||||||
DllExport char *GetIni(int n)
|
|
||||||
{
|
|
||||||
switch (n) {
|
|
||||||
case 1: return plgxini; break;
|
|
||||||
case 2: return nmfile; break;
|
|
||||||
case 3: return pdebug; break;
|
|
||||||
case 4: return version; break;
|
|
||||||
#if defined(XMSG)
|
|
||||||
case 5: return msglang; break;
|
|
||||||
#endif // XMSG
|
|
||||||
case 6: return connectini; break;
|
|
||||||
// default: return plgini;
|
|
||||||
} // endswitch GetIni
|
|
||||||
|
|
||||||
return plgini;
|
|
||||||
} // end of GetIni
|
|
||||||
|
|
||||||
DllExport void SetTrc(void)
|
DllExport void SetTrc(void)
|
||||||
{
|
{
|
||||||
// If tracing is on, debug must be initialized.
|
// If tracing is on, debug must be initialized.
|
||||||
@@ -418,138 +380,9 @@ char *PlgGetDataPath(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
PCATLG cat = PlgGetCatalog(g, false);
|
PCATLG cat = PlgGetCatalog(g, false);
|
||||||
|
|
||||||
//if (!cat)
|
|
||||||
// return GetIniString(g, NULL, "DataBase", "DataPath", "", plgini);
|
|
||||||
|
|
||||||
return (cat) ? cat->GetDataPath() : NULL;
|
return (cat) ? cat->GetDataPath() : NULL;
|
||||||
} // end of PlgGetDataPath
|
} // end of PlgGetDataPath
|
||||||
|
|
||||||
#if 0
|
|
||||||
/***********************************************************************/
|
|
||||||
/* PlgGetXdbPath: sets the fully qualified file name of a database */
|
|
||||||
/* description file in lgn and the new datapath in dp. */
|
|
||||||
/* New database description file is a Configuration Settings file */
|
|
||||||
/* that will be used and updated in case of DB modifications such */
|
|
||||||
/* as Insert into a VCT file. Look for it and use it if found. */
|
|
||||||
/* By default the configuration file is DataPath\name.xdb but the */
|
|
||||||
/* configuration file name may also be specified in Plugdb.ini. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool PlgSetXdbPath(PGLOBAL g, PSZ dbname, PSZ dbpath,
|
|
||||||
char *lgn, int lgsize,
|
|
||||||
char *path, int psize)
|
|
||||||
{
|
|
||||||
char *dp, datapath[_MAX_PATH], ft[_MAX_EXT] = ".xdb";
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
dp = path;
|
|
||||||
n = psize;
|
|
||||||
} else {
|
|
||||||
dp = datapath;
|
|
||||||
n = sizeof(datapath);
|
|
||||||
} // endif path
|
|
||||||
|
|
||||||
GetPrivateProfileString("DataBase", "DataPath", "", dp, n, plgini);
|
|
||||||
|
|
||||||
if (trace)
|
|
||||||
htrc("PlgSetXdbPath: path=%s\n", dp);
|
|
||||||
|
|
||||||
if (dbpath) {
|
|
||||||
char fn[_MAX_FNAME];
|
|
||||||
|
|
||||||
strcpy(lgn, dbpath);
|
|
||||||
_splitpath(lgn, NULL, NULL, fn, NULL);
|
|
||||||
|
|
||||||
if (!*fn) // Old style use command
|
|
||||||
strcat(lgn, dbname);
|
|
||||||
|
|
||||||
_splitpath(lgn, NULL, NULL, dbname, NULL); // Extract DB name
|
|
||||||
} else if (strcspn(dbname, ":/\\.") < strlen(dbname)) {
|
|
||||||
// dbname name contains the path name of the XDB file
|
|
||||||
strcpy(lgn, dbname);
|
|
||||||
_splitpath(lgn, NULL, NULL, dbname, NULL); // Extract DB name
|
|
||||||
} else
|
|
||||||
/*******************************************************************/
|
|
||||||
/* New database description file is a Configuration Settings file */
|
|
||||||
/* that will be used and updated in case of DB modifications such */
|
|
||||||
/* as Insert into a VCT file. Look for it and use it if found. */
|
|
||||||
/* By default the configuration file is DataPath\name.xdb but the */
|
|
||||||
/* configuration file name may also be specified in Plugdb.ini. */
|
|
||||||
/*******************************************************************/
|
|
||||||
GetPrivateProfileString("DBnames", dbname, "", lgn, lgsize, plgini);
|
|
||||||
|
|
||||||
if (*lgn) {
|
|
||||||
#if !defined(UNIX)
|
|
||||||
char drive[_MAX_DRIVE];
|
|
||||||
char direc[_MAX_DIR];
|
|
||||||
#endif
|
|
||||||
char fname[_MAX_FNAME];
|
|
||||||
char ftype[_MAX_EXT];
|
|
||||||
|
|
||||||
_splitpath(lgn, NULL, NULL, fname, ftype);
|
|
||||||
|
|
||||||
if (!*ftype)
|
|
||||||
strcat(lgn, ft);
|
|
||||||
else if (!stricmp(ftype, ".var")) {
|
|
||||||
strcpy(g->Message, MSG(NO_MORE_VAR));
|
|
||||||
return true;
|
|
||||||
} // endif ftype
|
|
||||||
|
|
||||||
// Given DB description path may be relative to data path
|
|
||||||
PlugSetPath(lgn, lgn, dp);
|
|
||||||
|
|
||||||
// New data path is the path of the configuration setting file
|
|
||||||
#if !defined(UNIX)
|
|
||||||
_splitpath(lgn, drive, direc, NULL, NULL);
|
|
||||||
_makepath(dp, drive, direc, "", "");
|
|
||||||
#else
|
|
||||||
//#error This must be tested for trailing slash
|
|
||||||
_splitpath(lgn, NULL, dp, NULL, NULL);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
// Try dbname[.ext] in the current directory
|
|
||||||
strcpy(lgn, dbname);
|
|
||||||
|
|
||||||
if (!strchr(dbname, '.'))
|
|
||||||
strcat(lgn, ft);
|
|
||||||
|
|
||||||
PlugSetPath(lgn, lgn, dp);
|
|
||||||
} // endif lgn
|
|
||||||
|
|
||||||
if (trace)
|
|
||||||
htrc("PlgSetXdbPath: new DB description file=%s\n", lgn);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} // end of PlgSetXdbPath
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Extract from a path name the required component. */
|
|
||||||
/* This function assumes there is enough space in the buffer. */
|
|
||||||
/***********************************************************************/
|
|
||||||
#if 0
|
|
||||||
char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op)
|
|
||||||
{
|
|
||||||
char *drive = NULL, *direc = NULL, *fname = NULL, *ftype = NULL;
|
|
||||||
|
|
||||||
switch (op) { // Determine which part to extract
|
|
||||||
#if !defined(UNIX)
|
|
||||||
case OP_FDISK: drive = pBuff; break;
|
|
||||||
#endif // !UNIX
|
|
||||||
case OP_FPATH: direc = pBuff; break;
|
|
||||||
case OP_FNAME: fname = pBuff; break;
|
|
||||||
case OP_FTYPE: ftype = pBuff; break;
|
|
||||||
default:
|
|
||||||
sprintf(g->Message, MSG(INVALID_OPER), op, "ExtractFromPath");
|
|
||||||
return NULL;
|
|
||||||
} // endswitch op
|
|
||||||
|
|
||||||
// Now do the extraction
|
|
||||||
_splitpath(FileName, drive, direc, fname, ftype);
|
|
||||||
return pBuff;
|
|
||||||
} // end of PlgExtractFromPath
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Check the occurence and matching of a pattern against a string. */
|
/* Check the occurence and matching of a pattern against a string. */
|
||||||
/* Because this function is only used for catalog name checking, */
|
/* Because this function is only used for catalog name checking, */
|
||||||
@@ -1459,19 +1292,17 @@ void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size)
|
|||||||
size = ((size + 7) / 8) * 8; /* Round up size to multiple of 8 */
|
size = ((size + 7) / 8) * 8; /* Round up size to multiple of 8 */
|
||||||
pph = (PPOOLHEADER)memp;
|
pph = (PPOOLHEADER)memp;
|
||||||
|
|
||||||
#if defined(DEBTRACE)
|
if (trace > 1)
|
||||||
htrc("PlgDBSubAlloc: memp=%p size=%d used=%d free=%d\n",
|
htrc("PlgDBSubAlloc: memp=%p size=%d used=%d free=%d\n",
|
||||||
memp, size, pph->To_Free, pph->FreeBlk);
|
memp, size, pph->To_Free, pph->FreeBlk);
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((uint)size > pph->FreeBlk) { /* Not enough memory left in pool */
|
if ((uint)size > pph->FreeBlk) { /* Not enough memory left in pool */
|
||||||
sprintf(g->Message,
|
sprintf(g->Message,
|
||||||
"Not enough memory in Work area for request of %d (used=%d free=%d)",
|
"Not enough memory in Work area for request of %d (used=%d free=%d)",
|
||||||
(int) size, pph->To_Free, pph->FreeBlk);
|
(int) size, pph->To_Free, pph->FreeBlk);
|
||||||
|
|
||||||
#if defined(DEBTRACE)
|
if (trace)
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif size
|
} // endif size
|
||||||
@@ -1482,10 +1313,11 @@ void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size)
|
|||||||
memp = MakePtr(memp, pph->To_Free); // Points to suballocated block
|
memp = MakePtr(memp, pph->To_Free); // Points to suballocated block
|
||||||
pph->To_Free += size; // New offset of pool free block
|
pph->To_Free += size; // New offset of pool free block
|
||||||
pph->FreeBlk -= size; // New size of pool free block
|
pph->FreeBlk -= size; // New size of pool free block
|
||||||
#if defined(DEBTRACE)
|
|
||||||
|
if (trace > 1)
|
||||||
htrc("Done memp=%p used=%d free=%d\n",
|
htrc("Done memp=%p used=%d free=%d\n",
|
||||||
memp, pph->To_Free, pph->FreeBlk);
|
memp, pph->To_Free, pph->FreeBlk);
|
||||||
#endif
|
|
||||||
return (memp);
|
return (memp);
|
||||||
} // end of PlgDBSubAlloc
|
} // end of PlgDBSubAlloc
|
||||||
|
|
||||||
|
@@ -37,8 +37,6 @@
|
|||||||
/* IBM Linker */
|
/* IBM Linker */
|
||||||
/* */
|
/* */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
//efine DEBTRACE 3
|
|
||||||
//efine DEBTRACE2
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -83,7 +81,6 @@
|
|||||||
extern HINSTANCE s_hModule; /* Saved module handle */
|
extern HINSTANCE s_hModule; /* Saved module handle */
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
extern char plgini[];
|
|
||||||
extern int trace;
|
extern int trace;
|
||||||
|
|
||||||
#if defined(XMSG)
|
#if defined(XMSG)
|
||||||
|
@@ -47,10 +47,6 @@
|
|||||||
#include "valblk.h"
|
#include "valblk.h"
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* External static variables. */
|
|
||||||
/***********************************************************************/
|
|
||||||
//extern "C" char plgini[];
|
|
||||||
|
|
||||||
/* --------------------------- Class RELDEF -------------------------- */
|
/* --------------------------- Class RELDEF -------------------------- */
|
||||||
|
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include "xtable.h"
|
#include "xtable.h"
|
||||||
#include "tabcol.h"
|
#include "tabcol.h"
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* XTAB public constructor. */
|
/* XTAB public constructor. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -33,9 +35,9 @@ XTAB::XTAB(LPCSTR name, LPCSTR srcdef) : Name(name)
|
|||||||
Schema = NULL;
|
Schema = NULL;
|
||||||
Qualifier = NULL;
|
Qualifier = NULL;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" making new TABLE %s %s\n", Name, Srcdef);
|
htrc("XTAB: making new TABLE %s %s\n", Name, Srcdef);
|
||||||
#endif
|
|
||||||
} // end of XTAB constructor
|
} // end of XTAB constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -49,9 +51,9 @@ XTAB::XTAB(PTABLE tp) : Name(tp->Name)
|
|||||||
Schema = tp->Schema;
|
Schema = tp->Schema;
|
||||||
Qualifier = tp->Qualifier;
|
Qualifier = tp->Qualifier;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" making copy TABLE %s %s\n", Name, Srcdef);
|
htrc(" making copy TABLE %s %s\n", Name, Srcdef);
|
||||||
#endif
|
|
||||||
} // end of XTAB constructor
|
} // end of XTAB constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -61,9 +63,8 @@ PTABLE XTAB::Link(PTABLE tab2)
|
|||||||
{
|
{
|
||||||
PTABLE tabp;
|
PTABLE tabp;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("Linking tables %s... to %s\n", Name, tab2->Name);
|
htrc("Linking tables %s... to %s\n", Name, tab2->Name);
|
||||||
#endif
|
|
||||||
|
|
||||||
for (tabp = this; tabp->Next; tabp = tabp->Next) ;
|
for (tabp = this; tabp->Next; tabp = tabp->Next) ;
|
||||||
|
|
||||||
@@ -118,9 +119,9 @@ COLUMN::COLUMN(LPCSTR name) : Name(name)
|
|||||||
To_Col = NULL;
|
To_Col = NULL;
|
||||||
Qualifier = NULL;
|
Qualifier = NULL;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc(" making new COLUMN %s\n", Name);
|
htrc(" making new COLUMN %s\n", Name);
|
||||||
#endif
|
|
||||||
} // end of COLUMN constructor
|
} // end of COLUMN constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -1351,7 +1351,7 @@ void CSVCOL::ReadColumn(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void CSVCOL::WriteColumn(PGLOBAL g)
|
void CSVCOL::WriteColumn(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char *p, buf[32];
|
char *p, buf[64];
|
||||||
int flen;
|
int flen;
|
||||||
PTDBCSV tdbp = (PTDBCSV)To_Tdb;
|
PTDBCSV tdbp = (PTDBCSV)To_Tdb;
|
||||||
|
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* TabMySQL C++ Program Source Code File (.CPP) *************/
|
/************* TabMySQL C++ Program Source Code File (.CPP) *************/
|
||||||
/* PROGRAM NAME: TABMYSQL */
|
/* PROGRAM NAME: TABMYSQL */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.7 */
|
/* Version 1.8 */
|
||||||
/* */
|
/* */
|
||||||
/* AUTHOR: */
|
/* AUTHOR: */
|
||||||
/* ------- */
|
/* ------- */
|
||||||
/* Olivier BERTRAND 2007-2013 */
|
/* Olivier BERTRAND 2007-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -1034,7 +1034,7 @@ int TDBMYSQL::WriteDB(PGLOBAL g)
|
|||||||
// Statement was not prepared, we must construct and execute
|
// Statement was not prepared, we must construct and execute
|
||||||
// an insert query for each line to insert
|
// an insert query for each line to insert
|
||||||
int rc;
|
int rc;
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
strcpy(Qbuf, Query);
|
strcpy(Qbuf, Query);
|
||||||
|
|
||||||
|
@@ -1066,7 +1066,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
|||||||
} // endif Buf_Type
|
} // endif Buf_Type
|
||||||
|
|
||||||
if (g->Trace) {
|
if (g->Trace) {
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
|
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
|
||||||
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
|
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
|
||||||
|
@@ -95,7 +95,7 @@ PIVAID::PIVAID(const char *tab, const char *src, const char *picol,
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char *query, *colname, buf[32];
|
char *query, *colname, buf[64];
|
||||||
int ndif, nblin, w = 0;
|
int ndif, nblin, w = 0;
|
||||||
PVAL valp;
|
PVAL valp;
|
||||||
PCOLRES *pcrp, crp, fncrp = NULL;
|
PCOLRES *pcrp, crp, fncrp = NULL;
|
||||||
@@ -121,7 +121,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
} // endif Exec
|
} // endif Exec
|
||||||
|
|
||||||
// We must have a storage query to get pivot column values
|
// We must have a storage query to get pivot column values
|
||||||
Qryp = Myc.GetResult(g);
|
Qryp = Myc.GetResult(g, true);
|
||||||
Myc.Close();
|
Myc.Close();
|
||||||
|
|
||||||
if (!Fncol) {
|
if (!Fncol) {
|
||||||
|
@@ -76,6 +76,8 @@
|
|||||||
char *strerror(int num);
|
char *strerror(int num);
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Char VCT column blocks are right filled with blanks (blank = true) */
|
/* Char VCT column blocks are right filled with blanks (blank = true) */
|
||||||
/* Conversion of block values allowed conditionally for insert only. */
|
/* Conversion of block values allowed conditionally for insert only. */
|
||||||
@@ -287,10 +289,9 @@ PCOL TDBVCT::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool TDBVCT::OpenDB(PGLOBAL g)
|
bool TDBVCT::OpenDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("VCT OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n",
|
htrc("VCT OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n",
|
||||||
this, Tdb_No, Use, To_Key_Col, Mode);
|
this, Tdb_No, Use, To_Key_Col, Mode);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Use == USE_OPEN) {
|
if (Use == USE_OPEN) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -344,12 +345,10 @@ bool TDBVCT::OpenDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBVCT::ReadDB(PGLOBAL g)
|
int TDBVCT::ReadDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
fprintf(debug,
|
htrc("VCT ReadDB: R%d Mode=%d CurBlk=%d CurNum=%d key=%p link=%p Kindex=%p\n",
|
||||||
"VCT ReadDB: R%d Mode=%d CurBlk=%d CurNum=%d key=%p link=%p Kindex=%p\n",
|
|
||||||
GetTdb_No(), Mode, Txfp->CurBlk, Txfp->CurNum,
|
GetTdb_No(), Mode, Txfp->CurBlk, Txfp->CurNum,
|
||||||
To_Key_Col, To_Link, To_Kindex);
|
To_Key_Col, To_Link, To_Kindex);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (To_Kindex) {
|
if (To_Kindex) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -524,15 +523,13 @@ void VCTCOL::ReadColumn(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
PTXF txfp = ((PTDBVCT)To_Tdb)->Txfp;
|
PTXF txfp = ((PTDBVCT)To_Tdb)->Txfp;
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBTRACE)
|
#if defined(_DEBUG)
|
||||||
assert (!To_Kcol);
|
assert (!To_Kcol);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("VCT ReadColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n",
|
||||||
"VCT ReadColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n",
|
|
||||||
Name, To_Tdb->GetTdb_No(), ColUse, Status, Buf_Type);
|
Name, To_Tdb->GetTdb_No(), ColUse, Status, Buf_Type);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ColBlk != txfp->CurBlk)
|
if (ColBlk != txfp->CurBlk)
|
||||||
ReadBlock(g);
|
ReadBlock(g);
|
||||||
@@ -558,11 +555,9 @@ void VCTCOL::WriteColumn(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
PTXF txfp = ((PTDBVCT)To_Tdb)->Txfp;;
|
PTXF txfp = ((PTDBVCT)To_Tdb)->Txfp;;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace > 1)
|
||||||
fprintf(debug,
|
htrc("VCT WriteColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n",
|
||||||
"VCT WriteColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n",
|
|
||||||
Name, To_Tdb->GetTdb_No(), ColUse, Status, Buf_Type);
|
Name, To_Tdb->GetTdb_No(), ColUse, Status, Buf_Type);
|
||||||
#endif
|
|
||||||
|
|
||||||
ColBlk = txfp->CurBlk;
|
ColBlk = txfp->CurBlk;
|
||||||
ColPos = txfp->CurNum;
|
ColPos = txfp->CurNum;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) Olivier Bertrand 2004 - 2012
|
/* Copyright (C) Olivier Bertrand 2004 - 2014
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Author: Olivier Bertrand -- bertrandop@gmail.com -- 2004-2012 */
|
/* Author: Olivier Bertrand -- bertrandop@gmail.com -- 2004-2014 */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||||
#pragma implementation // gcc: Class implementation
|
#pragma implementation // gcc: Class implementation
|
||||||
@@ -47,8 +47,7 @@
|
|||||||
#include "user_connect.h"
|
#include "user_connect.h"
|
||||||
#include "mycat.h"
|
#include "mycat.h"
|
||||||
|
|
||||||
extern "C" char plgxini[];
|
extern "C" int trace;
|
||||||
extern int xtrace;
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Initialize the user_connect static member. */
|
/* Initialize the user_connect static member. */
|
||||||
@@ -150,7 +149,7 @@ bool user_connect::CheckCleanup(void)
|
|||||||
g->Mrr = 0;
|
g->Mrr = 0;
|
||||||
last_query_id= thdp->query_id;
|
last_query_id= thdp->query_id;
|
||||||
|
|
||||||
if (xtrace)
|
if (trace)
|
||||||
printf("=====> Begin new query %llu\n", last_query_id);
|
printf("=====> Begin new query %llu\n", last_query_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -43,6 +43,8 @@
|
|||||||
#define CheckBlanks assert(!Blanks);
|
#define CheckBlanks assert(!Blanks);
|
||||||
#define CheckParms(V, N) ChkIndx(N); ChkTyp(V);
|
#define CheckParms(V, N) ChkIndx(N); ChkTyp(V);
|
||||||
|
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* AllocValBlock: allocate a VALBLK according to type. */
|
/* AllocValBlock: allocate a VALBLK according to type. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -51,10 +53,9 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len,
|
|||||||
{
|
{
|
||||||
PVBLK blkp;
|
PVBLK blkp;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("AVB: mp=%p type=%d nval=%d len=%d check=%u blank=%u\n",
|
htrc("AVB: mp=%p type=%d nval=%d len=%d check=%u blank=%u\n",
|
||||||
mp, type, nval, len, check, blank);
|
mp, type, nval, len, check, blank);
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
@@ -576,7 +577,7 @@ int TYPBLK<TYPE>::Find(PVAL vp)
|
|||||||
template <class TYPE>
|
template <class TYPE>
|
||||||
int TYPBLK<TYPE>::GetMaxLength(void)
|
int TYPBLK<TYPE>::GetMaxLength(void)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[64];
|
||||||
int i, n, m;
|
int i, n, m;
|
||||||
|
|
||||||
for (i = n = 0; i < Nval; i++) {
|
for (i = n = 0; i < Nval; i++) {
|
||||||
@@ -767,13 +768,13 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
|
|||||||
{
|
{
|
||||||
char *p = Chrp + n * Long;
|
char *p = Chrp + n * Long;
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBTRACE)
|
#if defined(_DEBUG)
|
||||||
if (Check && (signed)len > Long) {
|
if (Check && (signed)len > Long) {
|
||||||
PGLOBAL& g = Global;
|
PGLOBAL& g = Global;
|
||||||
strcpy(g->Message, MSG(SET_STR_TRUNC));
|
strcpy(g->Message, MSG(SET_STR_TRUNC));
|
||||||
longjmp(g->jumper[g->jump_level], Type);
|
longjmp(g->jumper[g->jump_level], Type);
|
||||||
} // endif Check
|
} // endif Check
|
||||||
#endif
|
#endif // _DEBUG
|
||||||
|
|
||||||
if (sp)
|
if (sp)
|
||||||
memcpy(p, sp, min((unsigned)Long, len));
|
memcpy(p, sp, min((unsigned)Long, len));
|
||||||
@@ -846,13 +847,13 @@ void CHRBLK::SetMax(PVAL valp, int n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void CHRBLK::SetValues(PVBLK pv, int k, int n)
|
void CHRBLK::SetValues(PVBLK pv, int k, int n)
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(DEBTRACE)
|
#if defined(_DEBUG)
|
||||||
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
|
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
|
||||||
PGLOBAL& g = Global;
|
PGLOBAL& g = Global;
|
||||||
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
|
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
|
||||||
longjmp(g->jumper[g->jump_level], Type);
|
longjmp(g->jumper[g->jump_level], Type);
|
||||||
} // endif Type
|
} // endif Type
|
||||||
#endif
|
#endif // _DEBUG
|
||||||
char *p = ((CHRBLK*)pv)->Chrp;
|
char *p = ((CHRBLK*)pv)->Chrp;
|
||||||
|
|
||||||
if (!k)
|
if (!k)
|
||||||
|
@@ -708,7 +708,7 @@ template <>
|
|||||||
bool TYPVAL<double>::SetValue_char(char *p, int n)
|
bool TYPVAL<double>::SetValue_char(char *p, int n)
|
||||||
{
|
{
|
||||||
if (p) {
|
if (p) {
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
for (; n > 0 && *p == ' '; p++)
|
for (; n > 0 && *p == ' '; p++)
|
||||||
n--;
|
n--;
|
||||||
@@ -1128,7 +1128,7 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
|
|||||||
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
|
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
if (!(Null = valp->IsNull() && Nullable))
|
if (!(Null = valp->IsNull() && Nullable))
|
||||||
strncpy(Strp, valp->GetCharString(buf), Len);
|
strncpy(Strp, valp->GetCharString(buf), Len);
|
||||||
@@ -1297,7 +1297,7 @@ void TYPVAL<PSZ>::SetValue(ulonglong n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void TYPVAL<PSZ>::SetValue(double f)
|
void TYPVAL<PSZ>::SetValue(double f)
|
||||||
{
|
{
|
||||||
char *p, buf[32];
|
char *p, buf[64];
|
||||||
PGLOBAL& g = Global;
|
PGLOBAL& g = Global;
|
||||||
int k = sprintf(buf, "%lf", f);
|
int k = sprintf(buf, "%lf", f);
|
||||||
|
|
||||||
@@ -1391,7 +1391,7 @@ bool TYPVAL<PSZ>::IsEqual(PVAL vp, bool chktype)
|
|||||||
else if (Null || vp->IsNull())
|
else if (Null || vp->IsNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
if (Ci || vp->IsCi())
|
if (Ci || vp->IsCi())
|
||||||
return !stricmp(Strp, vp->GetCharString(buf));
|
return !stricmp(Strp, vp->GetCharString(buf));
|
||||||
@@ -1548,7 +1548,7 @@ bool DECVAL::SetValue_pval(PVAL valp, bool chktype)
|
|||||||
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
|
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
if (!(Null = valp->IsNull() && Nullable))
|
if (!(Null = valp->IsNull() && Nullable))
|
||||||
strncpy(Strp, valp->GetCharString(buf), Len);
|
strncpy(Strp, valp->GetCharString(buf), Len);
|
||||||
@@ -1647,7 +1647,7 @@ bool DECVAL::IsEqual(PVAL vp, bool chktype)
|
|||||||
else if (Null || vp->IsNull())
|
else if (Null || vp->IsNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
return !strcmp(Strp, vp->GetCharString(buf));
|
return !strcmp(Strp, vp->GetCharString(buf));
|
||||||
} // end of IsEqual
|
} // end of IsEqual
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/***************** Xindex C++ Class Xindex Code (.CPP) *****************/
|
/***************** Xindex C++ Class Xindex Code (.CPP) *****************/
|
||||||
/* Name: XINDEX.CPP Version 2.8 */
|
/* Name: XINDEX.CPP Version 2.9 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2004-2013 */
|
/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the class XINDEX implementation code. */
|
/* This file contains the class XINDEX implementation code. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
/* DB static external variables. */
|
/* DB static external variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */
|
extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */
|
||||||
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Last two parameters are true to enable type checking, and last one */
|
/* Last two parameters are true to enable type checking, and last one */
|
||||||
@@ -267,10 +268,7 @@ int XINDEX::Qcompare(int *i1, int *i2)
|
|||||||
if ((k = kcp->Compare(*i1, *i2)))
|
if ((k = kcp->Compare(*i1, *i2)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
//num_comp++;
|
||||||
num_comp++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return k;
|
return k;
|
||||||
} // end of Qcompare
|
} // end of Qcompare
|
||||||
|
|
||||||
@@ -761,11 +759,11 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
|
|||||||
n[4] = Incr; // Increment of record positions
|
n[4] = Incr; // Increment of record positions
|
||||||
n[5] = Nblk; n[6] = Sblk;
|
n[5] = Nblk; n[6] = Sblk;
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace) {
|
||||||
printf("Saving index %s\n", Xdp->GetName());
|
htrc("Saving index %s\n", Xdp->GetName());
|
||||||
printf("ID=%d Nk=%d nof=%d Num_K=%d Incr=%d Nblk=%d Sblk=%d\n",
|
htrc("ID=%d Nk=%d nof=%d Num_K=%d Incr=%d Nblk=%d Sblk=%d\n",
|
||||||
ID, Nk, nof, Num_K, Incr, Nblk, Sblk);
|
ID, Nk, nof, Num_K, Incr, Nblk, Sblk);
|
||||||
#endif // TRACE
|
} // endif trace
|
||||||
|
|
||||||
size = X->Write(g, n, NZ, sizeof(int), rc);
|
size = X->Write(g, n, NZ, sizeof(int), rc);
|
||||||
dup->ProgCur = 1;
|
dup->ProgCur = 1;
|
||||||
@@ -804,9 +802,8 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
|
|||||||
dup->ProgCur += 5;
|
dup->ProgCur += 5;
|
||||||
} // endfor kcp
|
} // endfor kcp
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Index %s saved, Size=%d\n", Xdp->GetName(), Size);
|
htrc("Index %s saved, Size=%d\n", Xdp->GetName(), size);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
X->Close(fn, id);
|
X->Close(fn, id);
|
||||||
@@ -891,9 +888,8 @@ bool XINDEX::Init(PGLOBAL g)
|
|||||||
|
|
||||||
PlugSetPath(fn, fn, Tdbp->GetPath());
|
PlugSetPath(fn, fn, Tdbp->GetPath());
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Index %s file: %s\n", Xdp->GetName(), fn);
|
htrc("Index %s file: %s\n", Xdp->GetName(), fn);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Open the index file and check its validity. */
|
/* Open the index file and check its validity. */
|
||||||
@@ -905,18 +901,18 @@ bool XINDEX::Init(PGLOBAL g)
|
|||||||
if (X->Read(g, nv, NZ, sizeof(int)))
|
if (X->Read(g, nv, NZ, sizeof(int)))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("nv=%d %d %d %d %d %d %d\n",
|
htrc("nv=%d %d %d %d %d %d %d\n",
|
||||||
nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6]);
|
nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6]);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
// The test on ID was suppressed because MariaDB can change an index ID
|
// The test on ID was suppressed because MariaDB can change an index ID
|
||||||
// when other indexes are added or deleted
|
// when other indexes are added or deleted
|
||||||
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
||||||
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
||||||
#if defined(TRACE)
|
|
||||||
printf("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
if (trace)
|
||||||
#endif // TRACE
|
htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
||||||
|
|
||||||
goto err;
|
goto err;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1135,9 +1131,8 @@ bool XINDEX::Init(PGLOBAL g)
|
|||||||
|
|
||||||
PlugSetPath(fn, fn, Tdbp->GetPath());
|
PlugSetPath(fn, fn, Tdbp->GetPath());
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Index %s file: %s\n", Xdp->GetName(), fn);
|
htrc("Index %s file: %s\n", Xdp->GetName(), fn);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Get a view on the part of the index file containing this index. */
|
/* Get a view on the part of the index file containing this index. */
|
||||||
@@ -1157,19 +1152,19 @@ bool XINDEX::Init(PGLOBAL g)
|
|||||||
nv = (int*)mbase;
|
nv = (int*)mbase;
|
||||||
mbase += NZ * sizeof(int);
|
mbase += NZ * sizeof(int);
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("nv=%d %d %d %d %d %d %d\n",
|
htrc("nv=%d %d %d %d %d %d %d\n",
|
||||||
nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6]);
|
nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6]);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
// The test on ID was suppressed because MariaDB can change an index ID
|
// The test on ID was suppressed because MariaDB can change an index ID
|
||||||
// when other indexes are added or deleted
|
// when other indexes are added or deleted
|
||||||
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
||||||
// Not this index
|
// Not this index
|
||||||
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
||||||
#if defined(TRACE)
|
|
||||||
printf("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
if (trace)
|
||||||
#endif // TRACE
|
htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
||||||
|
|
||||||
goto err;
|
goto err;
|
||||||
} // endif nv
|
} // endif nv
|
||||||
|
|
||||||
@@ -1336,9 +1331,8 @@ bool XINDEX::GetAllSizes(PGLOBAL g, int &ndif, int &numk)
|
|||||||
|
|
||||||
PlugSetPath(fn, fn, Tdbp->GetPath());
|
PlugSetPath(fn, fn, Tdbp->GetPath());
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Index %s file: %s\n", Xdp->GetName(), fn);
|
htrc("Index %s file: %s\n", Xdp->GetName(), fn);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Open the index file and check its validity. */
|
/* Open the index file and check its validity. */
|
||||||
@@ -1354,17 +1348,17 @@ bool XINDEX::GetAllSizes(PGLOBAL g, int &ndif, int &numk)
|
|||||||
if (X->Read(g, nv, NZ, sizeof(int)))
|
if (X->Read(g, nv, NZ, sizeof(int)))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("nv=%d %d %d %d\n", nv[0], nv[1], nv[2], nv[3]);
|
htrc("nv=%d %d %d %d\n", nv[0], nv[1], nv[2], nv[3]);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
// The test on ID was suppressed because MariaDB can change an index ID
|
// The test on ID was suppressed because MariaDB can change an index ID
|
||||||
// when other indexes are added or deleted
|
// when other indexes are added or deleted
|
||||||
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
||||||
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
||||||
#if defined(TRACE)
|
|
||||||
printf("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
if (trace)
|
||||||
#endif // TRACE
|
htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
||||||
|
|
||||||
goto err;
|
goto err;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1597,9 +1591,8 @@ int XINDEX::Fetch(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
case OP_SAME: // Read next same
|
case OP_SAME: // Read next same
|
||||||
// Logically the key values should be the same as before
|
// Logically the key values should be the same as before
|
||||||
#if defined(TRACE)
|
if (trace > 1)
|
||||||
printf("looking for next same value\n");
|
htrc("looking for next same value\n");
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
if (NextVal(true)) {
|
if (NextVal(true)) {
|
||||||
Op = OP_EQ;
|
Op = OP_EQ;
|
||||||
@@ -1634,9 +1627,9 @@ int XINDEX::Fetch(PGLOBAL g)
|
|||||||
|
|
||||||
Nth++;
|
Nth++;
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace > 1)
|
||||||
printf("Fetch: Looking for new value\n");
|
htrc("Fetch: Looking for new value\n");
|
||||||
#endif // TRACE
|
|
||||||
Cur_K = FastFind(Nval);
|
Cur_K = FastFind(Nval);
|
||||||
|
|
||||||
if (Cur_K >= Num_K)
|
if (Cur_K >= Num_K)
|
||||||
@@ -1800,10 +1793,7 @@ XINDXS::XINDXS(PTDBDOS tdbp, PIXDEF xdp, PXLOAD pxp, PCOL *cp, PXOB *xp)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int XINDXS::Qcompare(int *i1, int *i2)
|
int XINDXS::Qcompare(int *i1, int *i2)
|
||||||
{
|
{
|
||||||
#ifdef DEBTRACE
|
//num_comp++;
|
||||||
num_comp++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return To_KeyCol->Compare(*i1, *i2);
|
return To_KeyCol->Compare(*i1, *i2);
|
||||||
} // end of Qcompare
|
} // end of Qcompare
|
||||||
|
|
||||||
@@ -1915,9 +1905,8 @@ int XINDXS::Fetch(PGLOBAL g)
|
|||||||
Op = OP_NEXT;
|
Op = OP_NEXT;
|
||||||
break;
|
break;
|
||||||
case OP_SAME: // Read next same
|
case OP_SAME: // Read next same
|
||||||
#if defined(TRACE)
|
if (trace > 1)
|
||||||
// printf("looking for next same value\n");
|
htrc("looking for next same value\n");
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
if (!Mul || NextVal(true)) {
|
if (!Mul || NextVal(true)) {
|
||||||
Op = OP_EQ;
|
Op = OP_EQ;
|
||||||
@@ -1945,9 +1934,8 @@ int XINDXS::Fetch(PGLOBAL g)
|
|||||||
else
|
else
|
||||||
Nth++;
|
Nth++;
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace > 1)
|
||||||
printf("Fetch: Looking for new value\n");
|
htrc("Fetch: Looking for new value\n");
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
Cur_K = FastFind(1);
|
Cur_K = FastFind(1);
|
||||||
|
|
||||||
@@ -2110,9 +2098,9 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode)
|
|||||||
} // endswitch mode
|
} // endswitch mode
|
||||||
|
|
||||||
if (!(Xfile= global_fopen(g, MSGID_OPEN_ERROR_AND_STRERROR, filename, pmod))) {
|
if (!(Xfile= global_fopen(g, MSGID_OPEN_ERROR_AND_STRERROR, filename, pmod))) {
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Open: %s\n", g->Message);
|
htrc("Open: %s\n", g->Message);
|
||||||
#endif // TRACE
|
|
||||||
return true;
|
return true;
|
||||||
} // endif Xfile
|
} // endif Xfile
|
||||||
|
|
||||||
@@ -2274,9 +2262,8 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
|
|||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf( "Xopen: filename=%s mode=%d\n", filename, mode);
|
htrc(" Xopen: filename=%s mode=%d\n", filename, mode);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
LONG high = 0;
|
LONG high = 0;
|
||||||
@@ -2319,11 +2306,9 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Hfile
|
} // endif Hfile
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
fprintf(debug,
|
htrc(" access=%p share=%p creation=%d handle=%p fn=%s\n",
|
||||||
" access=%p share=%p creation=%d handle=%p fn=%s\n",
|
|
||||||
access, share, creation, Hfile, filename);
|
access, share, creation, Hfile, filename);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mode == MODE_INSERT) {
|
if (mode == MODE_INSERT) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -2395,16 +2380,15 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
|
|||||||
|
|
||||||
if (Hfile == INVALID_HANDLE_VALUE) {
|
if (Hfile == INVALID_HANDLE_VALUE) {
|
||||||
/*rc = errno;*/
|
/*rc = errno;*/
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Open: %s\n", g->Message);
|
htrc("Open: %s\n", g->Message);
|
||||||
#endif // TRACE
|
|
||||||
return true;
|
return true;
|
||||||
} // endif Hfile
|
} // endif Hfile
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf(" rc=%d oflag=%p mode=%d handle=%d fn=%s\n",
|
htrc(" rc=%d oflag=%p mode=%d handle=%d fn=%s\n",
|
||||||
rc, oflag, mode, Hfile, filename);
|
rc, oflag, mode, Hfile, filename);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
if (mode == MODE_INSERT) {
|
if (mode == MODE_INSERT) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -2461,15 +2445,15 @@ bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin)
|
|||||||
|
|
||||||
if (lseek64(Hfile, pos, origin) < 0) {
|
if (lseek64(Hfile, pos, origin) < 0) {
|
||||||
sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
|
sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
|
||||||
#if defined(TRACE)
|
|
||||||
printf("lseek64 error %d\n", errno);
|
if (trace)
|
||||||
#endif // TRACE
|
htrc("lseek64 error %d\n", errno);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // endif lseek64
|
} // endif lseek64
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Seek: low=%d high=%d\n", low, high);
|
htrc("Seek: low=%d high=%d\n", low, high);
|
||||||
#endif // TRACE
|
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -2507,15 +2491,15 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size)
|
|||||||
#else // UNIX
|
#else // UNIX
|
||||||
ssize_t count = (ssize_t)(n * size);
|
ssize_t count = (ssize_t)(n * size);
|
||||||
|
|
||||||
#if defined(TRACE)
|
if (trace)
|
||||||
printf("Hfile=%d n=%d size=%d count=%d\n", Hfile, n, size, count);
|
htrc("Hfile=%d n=%d size=%d count=%d\n", Hfile, n, size, count);
|
||||||
#endif // TRACE
|
|
||||||
|
|
||||||
if (read(Hfile, buf, count) != count) {
|
if (read(Hfile, buf, count) != count) {
|
||||||
sprintf(g->Message, MSG(READ_ERROR), "Index file", strerror(errno));
|
sprintf(g->Message, MSG(READ_ERROR), "Index file", strerror(errno));
|
||||||
#if defined(TRACE)
|
|
||||||
printf("read error %d\n", errno);
|
if (trace)
|
||||||
#endif // TRACE
|
htrc("read error %d\n", errno);
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
} // endif nbr
|
} // endif nbr
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
@@ -2766,10 +2750,9 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
|||||||
Prefix = true;
|
Prefix = true;
|
||||||
} // endif kln
|
} // endif kln
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("KCOL(%p) Init: col=%s n=%d type=%d sm=%d\n",
|
htrc("KCOL(%p) Init: col=%s n=%d type=%d sm=%d\n",
|
||||||
this, colp->GetName(), n, colp->GetResultType(), sm);
|
this, colp->GetName(), n, colp->GetResultType(), sm);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Allocate the Value object used when moving items
|
// Allocate the Value object used when moving items
|
||||||
Type = colp->GetResultType();
|
Type = colp->GetResultType();
|
||||||
@@ -2820,10 +2803,9 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
|
|||||||
|
|
||||||
Type = colp->GetResultType();
|
Type = colp->GetResultType();
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
if (trace)
|
||||||
htrc("MapInit(%p): colp=%p type=%d n=%d len=%d m=%p\n",
|
htrc("MapInit(%p): colp=%p type=%d n=%d len=%d m=%p\n",
|
||||||
this, colp, Type, n[0], len, m);
|
this, colp, Type, n[0], len, m);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Allocate the Value object used when moving items
|
// Allocate the Value object used when moving items
|
||||||
Valp = AllocateValue(g, Type, len, prec, false, NULL);
|
Valp = AllocateValue(g, Type, len, prec, false, NULL);
|
||||||
@@ -2973,9 +2955,8 @@ int KXYCOL::Compare(int i1, int i2)
|
|||||||
// Do the actual comparison between values.
|
// Do the actual comparison between values.
|
||||||
register int k = Kblp->CompVal(i1, i2);
|
register int k = Kblp->CompVal(i1, i2);
|
||||||
|
|
||||||
#ifdef DEBUG2
|
if (trace > 2)
|
||||||
htrc("Compare done result=%d\n", k);
|
htrc("Compare done result=%d\n", k);
|
||||||
#endif
|
|
||||||
|
|
||||||
return (Asc) ? k : -k;
|
return (Asc) ? k : -k;
|
||||||
} // end of Compare
|
} // end of Compare
|
||||||
@@ -2986,13 +2967,14 @@ int KXYCOL::Compare(int i1, int i2)
|
|||||||
int KXYCOL::CompVal(int i)
|
int KXYCOL::CompVal(int i)
|
||||||
{
|
{
|
||||||
// Do the actual comparison between numerical values.
|
// Do the actual comparison between numerical values.
|
||||||
#ifdef DEBUG2
|
if (trace > 2) {
|
||||||
register int k = (int)Kblp->CompVal(Valp, (int)i);
|
register int k = (int)Kblp->CompVal(Valp, (int)i);
|
||||||
|
|
||||||
htrc("Compare done result=%d\n", k);
|
htrc("Compare done result=%d\n", k);
|
||||||
return k;
|
return k;
|
||||||
#endif
|
} else
|
||||||
return Kblp->CompVal(Valp, i);
|
return Kblp->CompVal(Valp, i);
|
||||||
|
|
||||||
} // end of CompVal
|
} // end of CompVal
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
Reference in New Issue
Block a user