summaryrefslogtreecommitdiff
path: root/storage/connect/valblk.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-12-16 01:32:47 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-12-16 01:32:47 +0100
commite2804d9b74099b9ae2b9f012be881d04dd78a75a (patch)
tree8e5aa2b7385605d0b82f23949b51e3119e8f262f /storage/connect/valblk.cpp
parentd8ac8d187d09303cb6fc0ee67216f8144ce5a053 (diff)
downloadmariadb-git-e2804d9b74099b9ae2b9f012be881d04dd78a75a.tar.gz
- Fix MDEV-5393 and MDEV-5434. It is a major update of ODBC catalog tables
processing that takes care of: - Drastically reduce the amount of storge needed to process them. - Handle longjmp's. - Makes the line limit an opion (MAXRES) - Schema can also be specified with the DBNAME option. - Issue warnings on fetch errors or when result lines have been limited. - Change some column names to reflect ODBC version 3 standard. The documentation have been updated accordingly modified: storage/connect/filamdbf.cpp storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/mysql-test/connect/r/odbc.result storage/connect/mysql-test/connect/r/odbc_postgresql.result storage/connect/mysql-test/connect/r/odbc_sqlite3.result storage/connect/mysql-test/connect/r/odbc_xls.result storage/connect/mysql-test/connect/r/xml.result storage/connect/mysql-test/connect/t/odbc_postgresql.test storage/connect/odbccat.h storage/connect/odbconn.cpp storage/connect/odbconn.h storage/connect/plgdbsem.h storage/connect/plgdbutl.cpp storage/connect/rcmsg.c storage/connect/tabfmt.cpp storage/connect/table.cpp storage/connect/tabodbc.cpp storage/connect/tabodbc.h storage/connect/tabutil.cpp storage/connect/tabwmi.cpp storage/connect/user_connect.cc storage/connect/valblk.cpp storage/connect/valblk.h storage/connect/value.cpp
Diffstat (limited to 'storage/connect/valblk.cpp')
-rw-r--r--storage/connect/valblk.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index afaff491249..59f5cdef586 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -246,12 +246,12 @@ void TYPBLK<TYPE>::SetValue(PVAL valp, int n)
ChkIndx(n);
ChkTyp(valp);
- if (!(b = valp->IsNull() && Nullable))
+ if (!(b = valp->IsNull()))
Typp[n] = GetTypedValue(valp);
else
Reset(n);
- SetNull(n, b);
+ SetNull(n, b && Nullable);
} // end of SetValue
template <>
@@ -671,12 +671,12 @@ void CHRBLK::SetValue(PVAL valp, int n)
ChkIndx(n);
ChkTyp(valp);
- if (!(b = valp->IsNull() && Nullable))
+ if (!(b = valp->IsNull()))
SetValue((PSZ)valp->GetCharValue(), n);
else
Reset(n);
- SetNull(n, b);
+ SetNull(n, b && Nullable);
} // end of SetValue
/***********************************************************************/
@@ -887,6 +887,7 @@ STRBLK::STRBLK(PGLOBAL g, void *mp, int nval)
{
Global = g;
Nullable = true;
+ Sorted = false;
} // end of STRBLK constructor
/***********************************************************************/
@@ -1026,8 +1027,12 @@ void STRBLK::SetValue(PVAL valp, int n)
void STRBLK::SetValue(PSZ p, int n)
{
if (p) {
- Strp[n] = (PSZ)PlugSubAlloc(Global, NULL, strlen(p) + 1);
- strcpy(Strp[n], p);
+ if (!Sorted || !n || !Strp[n-1] || strcmp(p, Strp[n-1])) {
+ Strp[n] = (PSZ)PlugSubAlloc(Global, NULL, strlen(p) + 1);
+ strcpy(Strp[n], p);
+ } else
+ Strp[n] = Strp[n-1];
+
} else
Strp[n] = NULL;
@@ -1041,9 +1046,14 @@ void STRBLK::SetValue(char *sp, uint len, int n)
PSZ p;
if (sp) {
- p = (PSZ)PlugSubAlloc(Global, NULL, len + 1);
- memcpy(p, sp, len);
- p[len] = 0;
+ if (!Sorted || !n || !Strp[n-1] || strlen(Strp[n-1]) != len ||
+ strncmp(sp, Strp[n-1], len)) {
+ p = (PSZ)PlugSubAlloc(Global, NULL, len + 1);
+ memcpy(p, sp, len);
+ p[len] = 0;
+ } else
+ Strp[n] = Strp[n-1];
+
} else
p = NULL;