MCPcopy Create free account
hub / github.com/MariaDB/server / Fetch

Method Fetch

storage/connect/odbconn.cpp:1616–1661  ·  view source on GitHub ↗

/ Fetch next row. */ /

Source from the content-addressed store, hash-verified

1614/* Fetch next row. */
1615/***********************************************************************/
1616int ODBConn::Fetch(int pos)
1617 {
1618 ASSERT(m_hstmt);
1619 int irc;
1620 SQLULEN crow;
1621 RETCODE rc;
1622 PGLOBAL& g = m_G;
1623
1624 try {
1625// do {
1626 if (pos) {
1627 rc = SQLExtendedFetch(m_hstmt, SQL_FETCH_ABSOLUTE, pos, &crow, NULL);
1628 } else if (m_RowsetSize) {
1629 rc = SQLExtendedFetch(m_hstmt, SQL_FETCH_NEXT, 1, &crow, NULL);
1630 } else {
1631 rc = SQLFetch(m_hstmt);
1632 crow = 1;
1633 } // endif m_RowsetSize
1634// } while (rc == SQL_STILL_EXECUTING);
1635
1636 if (trace(2))
1637 htrc("Fetch: hstmt=%p RowseSize=%d rc=%d\n",
1638 m_hstmt, m_RowsetSize, rc);
1639
1640 if (!Check(rc))
1641 ThrowDBX(rc, "Fetching", m_hstmt);
1642
1643 if (rc == SQL_NO_DATA_FOUND) {
1644 m_Full = (m_Fetch == 1);
1645 irc = 0;
1646 } else
1647 irc = (int)crow;
1648
1649 m_Fetch++;
1650 m_Rows += irc;
1651 } catch(DBX *x) {
1652 if (trace(1))
1653 for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
1654 htrc(x->m_ErrMsg[i]);
1655
1656 snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
1657 irc = -1;
1658 } // end try/catch
1659
1660 return irc;
1661 } // end of Fetch
1662
1663/***********************************************************************/
1664/* Prepare an SQL statement for insert. */

Callers

nothing calls this directly

Calls 3

GetErrorMessageMethod · 0.80
htrcFunction · 0.70
CheckClass · 0.50

Tested by

no test coverage detected