summaryrefslogtreecommitdiff
path: root/storage/connect/tabfmt.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-08-22 17:30:22 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-08-22 17:30:22 +0200
commitf930f4eda9dd849b48e67eaecc8c130bb9310107 (patch)
tree9b4cee3b93a6a2d5e7445f088449718c75786186 /storage/connect/tabfmt.cpp
parent8b9ed85b8a198e4de71677e3e9478c9162471e1b (diff)
downloadmariadb-git-f930f4eda9dd849b48e67eaecc8c130bb9310107.tar.gz
- Add a new CONNECT global variable allowing to tell whether or not
a temporary file should be used for UPDATE/DELETE of file tables. Also use the "sorted" argument of index_init to help decide if sorting of positions must be done. modified: storage/connect/checklvl.h storage/connect/connect.cc storage/connect/connect.h storage/connect/filamdbf.cpp storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/ha_connect.cc storage/connect/mysql-test/connect/r/part_table.result storage/connect/plgdbsem.h storage/connect/plgdbutl.cpp storage/connect/reldef.cpp storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabfix.cpp storage/connect/tabfmt.cpp storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/xindex.cpp - Fix a bug in TDBASE::ColDB that caused some special columns not to be found in the column list and reallocated without their Value causing a crash of some queries. modified: storage/connect/table.cpp - Fix a bug causing RestoreNrec to be called before closing a table causing a wrong value given to Spos modified: storage/connect/tabdos.cpp storage/connect/xindex.cpp - Add a new CONNECT global variable connect_exact_info. Set to ON, it tells CONNECT to return exact record numbers on info queries. If OFF it just gives an estimate. In version 10.0.13 this was unconditionally ON and caused info queries on remote tables to be extremely long and was the subject of MDEV-6612. modified: storage/connect/ha_connect.cc storage/connect/tabdos.cpp storage/connect/tabmysql.cpp storage/connect/tabodbc.cpp
Diffstat (limited to 'storage/connect/tabfmt.cpp')
-rw-r--r--storage/connect/tabfmt.cpp43
1 files changed, 36 insertions, 7 deletions
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index b2d60d87f3b..a011b62dc7c 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -66,7 +66,8 @@
#define MAXCOL 200 /* Default max column nb in result */
#define TYPE_UNKNOWN 10 /* Must be greater than other types */
-extern "C" int trace;
+extern "C" int trace;
+extern "C" USETEMP Use_Temp;
/***********************************************************************/
/* CSVColumns: constructs the result blocks containing the description */
@@ -441,7 +442,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
PTDBASE tdbp;
if (Catfunc != FNC_COL) {
- USETEMP tmp = PlgGetUser(g)->UseTemp;
+ USETEMP tmp = Use_Temp;
bool map = Mapped && mode != MODE_INSERT &&
!(tmp != TMP_NO && mode == MODE_UPDATE) &&
!(tmp == TMP_FORCE &&
@@ -479,6 +480,36 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
if (Multiple)
tdbp = new(g) TDBMUL(tdbp);
+ else
+ /*****************************************************************/
+ /* For block tables, get eventually saved optimization values. */
+ /*****************************************************************/
+ if (tdbp->GetBlockValues(g)) {
+ PushWarning(g, tdbp);
+// return NULL; // causes a crash when deleting index
+ } else {
+ if (IsOptimized()) {
+ if (map) {
+ txfp = new(g) MBKFAM(this);
+ } else if (Compressed) {
+#if defined(ZIP_SUPPORT)
+ if (Compressed == 1)
+ txfp = new(g) ZBKFAM(this);
+ else {
+ txfp->SetBlkPos(To_Pos);
+ ((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
+ } // endelse
+#else
+ sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
+ return NULL;
+#endif
+ } else
+ txfp = new(g) BLKFAM(this);
+
+ ((PTDBDOS)tdbp)->SetTxfp(txfp);
+ } // endif Optimized
+
+ } // endelse
} else
tdbp = new(g)TDBCCL(this);
@@ -605,14 +636,12 @@ int TDBCSV::EstimatedLength(PGLOBAL g)
#if 0
/***********************************************************************/
-/* CSV tables favor the use temporary files for Update. */
+/* CSV tables needs the use temporary files for Update. */
/***********************************************************************/
bool TDBCSV::IsUsingTemp(PGLOBAL g)
{
- USETEMP usetemp = PlgGetUser(g)->UseTemp;
-
- return (usetemp == TMP_YES || usetemp == TMP_FORCE ||
- (usetemp == TMP_AUTO && Mode == MODE_UPDATE));
+ return (Use_Temp == TMP_YES || Use_Temp == TMP_FORCE ||
+ (Use_Temp == TMP_AUTO && Mode == MODE_UPDATE));
} // end of IsUsingTemp
#endif // 0 (Same as TDBDOS one)