summaryrefslogtreecommitdiff
path: root/storage/connect/odbconn.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-11-24 18:26:44 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2014-11-24 18:26:44 +0100
commitc89b8a38de20c00bb6d9d822f7f027ce9fcf51d8 (patch)
tree6ced32257c5625be945b684f85703ea162643480 /storage/connect/odbconn.cpp
parent6211708a95a64728350ad8d0d3cc374388d49307 (diff)
downloadmariadb-git-c89b8a38de20c00bb6d9d822f7f027ce9fcf51d8.tar.gz
- Enhance the implementation of ODBC tables when using scrollable cursor
modified: storage/connect/odbconn.cpp storage/connect/odbconn.h storage/connect/tabodbc.cpp
Diffstat (limited to 'storage/connect/odbconn.cpp')
-rw-r--r--storage/connect/odbconn.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index b68b4648616..e614980a57a 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -2439,29 +2439,31 @@ PQRYRES ODBConn::AllocateResult(PGLOBAL g)
/***********************************************************************/
/* Restart from beginning of result set */
/***********************************************************************/
-bool ODBConn::Rewind(char *sql, ODBCCOL *tocols)
+int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
{
- RETCODE rc;
+ int rc, rbuf = -1;
if (!m_hstmt)
- return false;
+ return rbuf;
if (m_Scrollable) {
+ SQLULEN crow;
+
try {
- rc = SQLFetchScroll(m_hstmt, SQL_FETCH_ABSOLUTE, 0);
+ rc = SQLExtendedFetch(m_hstmt, SQL_FETCH_FIRST, 1, &crow, NULL);
- if (rc != SQL_NO_DATA_FOUND)
- ThrowDBX(rc, "SQLFetchScroll", m_hstmt);
+ if (!Check(rc))
+ ThrowDBX(rc, "SQLExtendedFetch", m_hstmt);
+ rbuf = (int)crow;
} catch(DBX *x) {
strcpy(m_G->Message, x->GetErrorMessage(0));
- return true;
} // end try/catch
- } else if (ExecDirectSQL(sql, tocols) < 0)
- return true;
+ } else if (ExecDirectSQL(sql, tocols) >= 0)
+ rbuf = 0;
- return false;
+ return rbuf;
} // end of Rewind
/***********************************************************************/