summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-12-14 22:47:12 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2014-12-14 22:47:12 +0100
commit8761f22a11e3ebe9563b93bb79cb65260b177873 (patch)
tree0d1e71ae0474feb957c7ce7a29bcfe4a03d8d7bb /storage/connect
parent75c461d569d651e6736e5f0e8de1c85a0e485854 (diff)
downloadmariadb-git-8761f22a11e3ebe9563b93bb79cb65260b177873.tar.gz
- Temporary fix for MDEV-7304.
modified: storage/connect/rcmsg.c - Avoid Memory copying when reading an ODBC table when the entire table is already in the result set. modified: storage/connect/odbconn.cpp storage/connect/odbconn.h storage/connect/tabodbc.cpp storage/connect/tabodbc.h
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/odbconn.cpp22
-rw-r--r--storage/connect/odbconn.h3
-rw-r--r--storage/connect/rcmsg.c3
-rw-r--r--storage/connect/tabodbc.cpp6
-rw-r--r--storage/connect/tabodbc.h4
5 files changed, 28 insertions, 10 deletions
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index e614980a57a..b9cf8054e3a 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -922,6 +922,8 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp)
m_Updatable = true;
m_Transact = false;
m_Scrollable = (tdbp) ? tdbp->Scrollable : false;
+ m_First = true;
+ m_Full = false;
m_IDQuoteChar[0] = '"';
m_IDQuoteChar[1] = 0;
//*m_ErrMsg = '\0';
@@ -1509,6 +1511,16 @@ int ODBConn::Fetch()
irc = (rc == SQL_NO_DATA_FOUND) ? 0 : (int)crow;
+ if (m_First) {
+ // First fetch. Check whether the full table was read
+ if ((m_Full = irc < (signed)m_RowsetSize)) {
+ m_Tdb->Memory = 0; // Not needed anymore
+ m_Rows = irc; // Table size
+ } // endif m_Full
+
+ m_First = false;
+ } // endif m_First
+
if (m_Tdb->Memory == 1)
m_Rows += irc;
@@ -2441,12 +2453,13 @@ PQRYRES ODBConn::AllocateResult(PGLOBAL g)
/***********************************************************************/
int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
{
- int rc, rbuf = -1;
+ int rc, rbuf;
if (!m_hstmt)
- return rbuf;
-
- if (m_Scrollable) {
+ rbuf = -1;
+ else if (m_Full)
+ rbuf = m_Rows; // No need to "rewind"
+ else if (m_Scrollable) {
SQLULEN crow;
try {
@@ -2458,6 +2471,7 @@ int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
rbuf = (int)crow;
} catch(DBX *x) {
strcpy(m_G->Message, x->GetErrorMessage(0));
+ rbuf = -1;
} // end try/catch
} else if (ExecDirectSQL(sql, tocols) >= 0)
diff --git a/storage/connect/odbconn.h b/storage/connect/odbconn.h
index ff8357c4591..021b4fe45fb 100644
--- a/storage/connect/odbconn.h
+++ b/storage/connect/odbconn.h
@@ -194,5 +194,6 @@ class ODBConn : public BLOCK {
bool m_Updatable;
bool m_Transact;
bool m_Scrollable;
- bool m_Memory;
+ bool m_First;
+ bool m_Full;
}; // end of ODBConn class definition
diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c
index abd74d169cc..9eea944c697 100644
--- a/storage/connect/rcmsg.c
+++ b/storage/connect/rcmsg.c
@@ -31,6 +31,8 @@ char *GetMsgid(int id)
{
char *p = NULL;
+ // This conditional until a real fix is found for MDEV-7304
+#if defined(FRENCH)
if (!stricmp(msglang(), "french"))
switch (id) {
#include "frids.h"
@@ -40,6 +42,7 @@ char *GetMsgid(int id)
} // endswitch(id)
else // English
+#endif // FRENCH
switch (id) {
#include "enids.h"
#if defined(NEWMSG)
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 6608083f1b4..ee137187af8 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -95,7 +95,7 @@ ODBCDEF::ODBCDEF(void)
{
Connect= Tabname= Tabschema= Tabcat= Srcdef= Qchar= Qrystr= Sep= NULL;
Catver = Options = Quoted = Maxerr = Maxres = 0;
- Scrollable = Xsrc = false;
+ Scrollable = Memory = Xsrc = false;
} // end of ODBCDEF constructor
/***********************************************************************/
@@ -880,7 +880,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
if (To_Kindex) {
// Direct access of ODBC tables is not implemented yet
strcpy(g->Message, MSG(NO_ODBC_DIRECT));
- longjmp(g->jumper[g->jump_level], GetAmType());
+ return RC_FX;
} // endif To_Kindex
/*********************************************************************/
@@ -1152,7 +1152,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
} // endif Trace
-put:
+ put:
if (tdbp->Memory != 2)
return;
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index da9d373add8..4fa0f2b751c 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -1,7 +1,7 @@
/*************** Tabodbc H Declares Source Code File (.H) **************/
-/* Name: TABODBC.H Version 1.6 */
+/* Name: TABODBC.H Version 1.7 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2014 */
/* */
/* This file contains the TDBODBC classes declares. */
/***********************************************************************/