summaryrefslogtreecommitdiff
path: root/storage/connect/filamap.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-03-18 19:25:50 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2014-03-18 19:25:50 +0100
commit6b63c5b2479084d5b7ead016d4d0f5cf7d28e47c (patch)
treecad7294d5982ebe2185cdce766901a7043e33e1e /storage/connect/filamap.cpp
parente5729127b8a50a0e553fd8b87b2683e4a684dfcc (diff)
downloadmariadb-git-6b63c5b2479084d5b7ead016d4d0f5cf7d28e47c.tar.gz
- FIX PIVOT bug MDEV-5869 caused by using fop (field option ptr) when NULL.
modified: storage/connect/ha_connect.cc - Suppress the use of connect.in by adding the connect_xtrace system variable. modified: storage/connect/ha_connect.cc - Make column length, varchar, and temporal column types recognized in discovery when using SRCDEF,or PIVOT. modified: storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/myutil.cpp storage/connect/plgdbsem.h - Avoid (rare) crash when using DECIMAL type. (buf was too small) modified: storage/connect/tabfmt.cpp storage/connect/tabmysql.cpp storage/connect/tabodbc.cpp storage/connect/tabpivot.cpp storage/connect/valblk.cpp storage/connect/value.cpp - General cleaning of unused code, standardize tracing, and update version number 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/filamzip.cpp storage/connect/ha_connect.cc storage/connect/mycat.cc storage/connect/myconn.cpp storage/connect/mysql-test/connect/r/alter.result storage/connect/mysql-test/connect/r/xml.result 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
Diffstat (limited to 'storage/connect/filamap.cpp')
-rw-r--r--storage/connect/filamap.cpp65
1 files changed, 31 insertions, 34 deletions
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 48f5e9d3f80..f8a4e7d2f2b 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -46,6 +46,8 @@
#include "filamap.h"
#include "tabdos.h"
+extern "C" int trace;
+
/* --------------------------- Class MAPFAM -------------------------- */
/***********************************************************************/
@@ -89,9 +91,8 @@ int MAPFAM::GetFileLength(PGLOBAL g)
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g);
-#ifdef DEBTRACE
- htrc("Mapped file length=%d\n", len);
-#endif
+ if (trace)
+ htrc("Mapped file length=%d\n", len);
return len;
} // end of GetFileLength
@@ -128,9 +129,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
&& fp->Count && fp->Mode == mode)
break;
-#ifdef DEBTRACE
- htrc("Mapping file, fp=%p\n", fp);
-#endif
+ if (trace)
+ htrc("Mapping file, fp=%p\n", fp);
+
} else
fp = NULL;
@@ -166,9 +167,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
"map", (int) rc, filename);
-#ifdef DEBTRACE
- htrc("%s\n", g->Message);
-#endif
+ if (trace)
+ htrc("CreateFileMap: %s\n", g->Message);
+
return (mode == MODE_READ && rc == ENOENT)
? PushWarning(g, Tdbp) : true;
} // endif hFile
@@ -228,10 +229,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
Fpos = Mempos = Memory;
Top = Memory + len;
-#ifdef DEBTRACE
- htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
- fp, fp->Count, Memory, len, Top);
-#endif
+ if (trace)
+ htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
+ fp, fp->Count, Memory, len, Top);
return AllocateBuffer(g); // Useful for DBF files
} // end of OpenTableFile
@@ -365,20 +365,19 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
{
int n;
-#ifdef DEBTRACE
- fprintf(debug,
- "MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
- irc, Mempos, To_Buf, Tpos, Spos);
-#endif
+ if (trace)
+ htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
+ irc, Mempos, To_Buf, Tpos, Spos);
if (irc != RC_OK) {
/*******************************************************************/
/* EOF: position Fpos at the top of map position. */
/*******************************************************************/
Fpos = Top;
-#ifdef DEBTRACE
- htrc("Fpos placed at file top=%p\n", Fpos);
-#endif
+
+ if (trace)
+ htrc("Fpos placed at file top=%p\n", Fpos);
+
} // endif irc
if (Tpos == Spos)
@@ -394,17 +393,16 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
memmove(Tpos, Spos, n);
Tpos += n;
-#ifdef DEBTRACE
- htrc("move %d bytes\n", n);
-#endif
+ if (trace)
+ htrc("move %d bytes\n", n);
+
} // endif n
if (irc == RC_OK) {
Spos = Mempos; // New start position
-#ifdef DEBTRACE
- htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
-#endif
+ if (trace)
+ htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
} else if (To_Fb) { // Can be NULL for deleted files
/*******************************************************************/
@@ -432,9 +430,8 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
return RC_FX;
} // endif
-#ifdef DEBTRACE
- htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
-#endif
+ if (trace)
+ htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
if (!SetEndOfFile(fp->Handle)) {
sprintf(g->Message, MSG(FUNCTION_ERROR),
@@ -466,10 +463,10 @@ void MAPFAM::CloseTableFile(PGLOBAL g)
PlugCloseFile(g, To_Fb);
To_Fb = NULL; // To get correct file size in Cardinality
-#ifdef DEBTRACE
- htrc("MAP Close: closing %s count=%d\n",
- To_File, (To_Fb) ? To_Fb->Count : 0);
-#endif
+ if (trace)
+ htrc("MAP Close: closing %s count=%d\n",
+ To_File, (To_Fb) ? To_Fb->Count : 0);
+
} // end of CloseTableFile
/***********************************************************************/