Commit c144cf38 authored by Olivier Bertrand's avatar Olivier Bertrand

- Implement putting in memory the result set from an ODBC query.

modified:
  storage/connect/odbconn.cpp
  storage/connect/odbconn.h
  storage/connect/tabodbc.cpp
  storage/connect/tabodbc.h

- Moving the calls to VerifyConnect and GetConnectInfo into the try block
  in ODBConn::Open (potential crash in case of throw)
modified:
  storage/connect/odbconn.cpp

- Handling all ODBC data date types (91, 92, 93)
modified:
  storage/connect/ha_connect.cc
  storage/connect/odbconn.cpp

- Not assuming string results from ODBC catalog functions are zero terminated
modified:
  storage/connect/odbconn.cpp
parent cfa872f6
...@@ -5190,6 +5190,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5190,6 +5190,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
tm= NOT_NULL_FLAG; tm= NOT_NULL_FLAG;
cnm= (char*)"noname"; cnm= (char*)"noname";
dft= xtra= key= NULL; dft= xtra= key= NULL;
v= ' ';
#if defined(NEW_WAY) #if defined(NEW_WAY)
rem= ""; rem= "";
// cs= NULL; // cs= NULL;
......
...@@ -146,18 +146,25 @@ int TranslateSQLType(int stp, int prec, int& len, char& v) ...@@ -146,18 +146,25 @@ int TranslateSQLType(int stp, int prec, int& len, char& v)
type = TYPE_DOUBLE; type = TYPE_DOUBLE;
break; break;
case SQL_DATETIME: // 9 case SQL_DATETIME: // 9
// case SQL_DATE: // 9 type = TYPE_DATE;
len = 19;
break;
case SQL_TYPE_DATE: // 91
type = TYPE_DATE; type = TYPE_DATE;
len = 10; len = 10;
v = 'D';
break; break;
case SQL_INTERVAL: // 10 case SQL_INTERVAL: // 10
// case SQL_TIME: // 10 case SQL_TYPE_TIME: // 92
type = TYPE_STRING; type = TYPE_STRING;
len = 8 + ((prec) ? (prec+1) : 0); len = 8 + ((prec) ? (prec+1) : 0);
v = 'T';
break; break;
case SQL_TIMESTAMP: // 11 case SQL_TIMESTAMP: // 11
case SQL_TYPE_TIMESTAMP: // 93
type = TYPE_DATE; type = TYPE_DATE;
len = 19 + ((prec) ? (prec+1) : 0); len = 19 + ((prec) ? (prec+1) : 0);
v = 'S';
break; break;
case SQL_BIGINT: // (-5) case SQL_BIGINT: // (-5)
type = TYPE_BIGINT; type = TYPE_BIGINT;
...@@ -910,6 +917,7 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp) ...@@ -910,6 +917,7 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp)
m_UpdateOptions = 0; m_UpdateOptions = 0;
m_RowsetSize = (DWORD)((tdbp) ? tdbp->Rows : 10); m_RowsetSize = (DWORD)((tdbp) ? tdbp->Rows : 10);
m_Catver = (tdbp) ? tdbp->Catver : 0; m_Catver = (tdbp) ? tdbp->Catver : 0;
m_Rows = 0;
m_Connect = NULL; m_Connect = NULL;
m_Updatable = true; m_Updatable = true;
m_Transact = false; m_Transact = false;
...@@ -1068,6 +1076,9 @@ int ODBConn::Open(PSZ ConnectString, DWORD options) ...@@ -1068,6 +1076,9 @@ int ODBConn::Open(PSZ ConnectString, DWORD options)
} // endif } // endif
/*ver = GetStringInfo(SQL_DRIVER_ODBC_VER);*/ /*ver = GetStringInfo(SQL_DRIVER_ODBC_VER);*/
// Verify support for required functionality and cache info
// VerifyConnect(); Deprecated
GetConnectInfo();
} catch(DBX *xp) { } catch(DBX *xp) {
// strcpy(g->Message, xp->m_ErrMsg[0]); // strcpy(g->Message, xp->m_ErrMsg[0]);
strcpy(g->Message, xp->GetErrorMessage(0)); strcpy(g->Message, xp->GetErrorMessage(0));
...@@ -1076,9 +1087,6 @@ int ODBConn::Open(PSZ ConnectString, DWORD options) ...@@ -1076,9 +1087,6 @@ int ODBConn::Open(PSZ ConnectString, DWORD options)
return -1; return -1;
} // end try-catch } // end try-catch
// Verify support for required functionality and cache info
VerifyConnect();
GetConnectInfo();
return 1; return 1;
} // end of Open } // end of Open
...@@ -1500,6 +1508,10 @@ int ODBConn::Fetch() ...@@ -1500,6 +1508,10 @@ int ODBConn::Fetch()
ThrowDBX(rc, "Fetch", m_hstmt); ThrowDBX(rc, "Fetch", m_hstmt);
irc = (rc == SQL_NO_DATA_FOUND) ? 0 : (int)crow; irc = (rc == SQL_NO_DATA_FOUND) ? 0 : (int)crow;
if (m_Tdb->Memory == 1)
m_Rows += irc;
} catch(DBX *x) { } catch(DBX *x) {
if (trace) if (trace)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
...@@ -2150,6 +2162,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2150,6 +2162,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
HSTMT hstmt = NULL; HSTMT hstmt = NULL;
SQLLEN *vl, *vlen = NULL; SQLLEN *vl, *vlen = NULL;
PVAL *pval = NULL; PVAL *pval = NULL;
char* *pbuf = NULL;
try { try {
b = false; b = false;
...@@ -2226,6 +2239,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2226,6 +2239,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
// Unconditional to handle STRBLK's // Unconditional to handle STRBLK's
pval = (PVAL *)PlugSubAlloc(g, NULL, n * sizeof(PVAL)); pval = (PVAL *)PlugSubAlloc(g, NULL, n * sizeof(PVAL));
vlen = (SQLLEN *)PlugSubAlloc(g, NULL, n * sizeof(SQLLEN)); vlen = (SQLLEN *)PlugSubAlloc(g, NULL, n * sizeof(SQLLEN));
pbuf = (char**)PlugSubAlloc(g, NULL, n * sizeof(char*));
// Now bind the column buffers // Now bind the column buffers
for (n = 0, crp = qrp->Colresp; crp; crp = crp->Next) { for (n = 0, crp = qrp->Colresp; crp; crp = crp->Next) {
...@@ -2240,7 +2254,13 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2240,7 +2254,13 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} // endif len } // endif len
pval[n] = AllocateValue(g, crp->Type, len); pval[n] = AllocateValue(g, crp->Type, len);
buffer = pval[n]->GetTo_Val();
if (crp->Type == TYPE_STRING) {
pbuf[n] = (char*)PlugSubAlloc(g, NULL, len);
buffer = pbuf[n];
} else
buffer = pval[n]->GetTo_Val();
vl = vlen + n; vl = vlen + n;
// n + 1 because column numbers begin with 1 // n + 1 because column numbers begin with 1
...@@ -2288,7 +2308,13 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2288,7 +2308,13 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} // endif rc } // endif rc
for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) { for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) {
pval[n]->SetNull(vlen[n] == SQL_NULL_DATA); if (vlen[n] == SQL_NULL_DATA)
pval[n]->SetNull(true);
else if (crp->Type == TYPE_STRING && vlen[n] != SQL_NULL_DATA)
pval[n]->SetValue_char(pbuf[n], vlen[n]);
else
pval[n]->SetNull(false);
crp->Kdata->SetValue(pval[n], i); crp->Kdata->SetValue(pval[n], i);
cap->Vlen[n][i] = vlen[n]; cap->Vlen[n][i] = vlen[n];
} // endfor crp } // endfor crp
...@@ -2342,6 +2368,76 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2342,6 +2368,76 @@ int ODBConn::GetCatInfo(CATPARM *cap)
return irc; return irc;
} // end of GetCatInfo } // end of GetCatInfo
/***********************************************************************/
/* Allocate a CONNECT result structure from the ODBC result. */
/***********************************************************************/
PQRYRES ODBConn::AllocateResult(PGLOBAL g)
{
//char *fmt, v;
int n;
bool uns;
PODBCCOL colp;
PCOLRES *pcrp, crp;
PQRYRES qrp;
if (!m_Rows) {
strcpy(g->Message, "Void result");
return NULL;
} // endif m_Res
/*********************************************************************/
/* Allocate the result storage for future retrieval. */
/*********************************************************************/
qrp = (PQRYRES)PlugSubAlloc(g, NULL, sizeof(QRYRES));
pcrp = &qrp->Colresp;
qrp->Continued = FALSE;
qrp->Truncated = FALSE;
qrp->Info = FALSE;
qrp->Suball = TRUE;
qrp->BadLines = 0;
qrp->Maxsize = m_Rows;
qrp->Maxres = m_Rows;
qrp->Nbcol = 0;
qrp->Nblin = 0;
qrp->Cursor = 0;
for (n = 1, colp = (PODBCCOL)m_Tdb->Columns; colp;
colp = (PODBCCOL)colp->GetNext())
if (!colp->IsSpecial()) {
*pcrp = (PCOLRES)PlugSubAlloc(g, NULL, sizeof(COLRES));
crp = *pcrp;
pcrp = &crp->Next;
memset(crp, 0, sizeof(COLRES));
crp->Ncol = ++qrp->Nbcol;
crp->Name = colp->GetName();
crp->Type = colp->GetResultType();
crp->Prec = colp->GetScale();
crp->Length = colp->GetLength();
crp->Clen = colp->GetBuflen();
uns = colp->IsUnsigned();
if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows,
crp->Clen, 0, FALSE, TRUE, uns))) {
sprintf(g->Message, MSG(INV_RESULT_TYPE),
GetFormatType(crp->Type));
return NULL;
} // endif Kdata
if (!colp->IsNullable())
crp->Nulls = NULL;
else {
crp->Nulls = (char*)PlugSubAlloc(g, NULL, m_Rows);
memset(crp->Nulls, ' ', m_Rows);
} // endelse Nullable
colp->SetCrp(crp);
} // endif colp
*pcrp = NULL;
//qrp->Nblin = n;
return qrp;
} // end of AllocateResult
/***********************************************************************/ /***********************************************************************/
/* Restart from beginning of result set */ /* Restart from beginning of result set */
/***********************************************************************/ /***********************************************************************/
...@@ -2382,7 +2478,7 @@ void ODBConn::Close() ...@@ -2382,7 +2478,7 @@ void ODBConn::Close()
rc = SQLFreeStmt(m_hstmt, SQL_DROP); rc = SQLFreeStmt(m_hstmt, SQL_DROP);
m_hstmt = NULL; m_hstmt = NULL;
} // endif m_hstmt } // endif m_hstmt
if (m_hdbc != SQL_NULL_HDBC) { if (m_hdbc != SQL_NULL_HDBC) {
if (m_Transact) { if (m_Transact) {
rc = SQLEndTran(SQL_HANDLE_DBC, m_hdbc, SQL_COMMIT); rc = SQLEndTran(SQL_HANDLE_DBC, m_hdbc, SQL_COMMIT);
......
...@@ -126,6 +126,7 @@ class ODBConn : public BLOCK { ...@@ -126,6 +126,7 @@ class ODBConn : public BLOCK {
int Open(PSZ ConnectString, DWORD Options = 0); int Open(PSZ ConnectString, DWORD Options = 0);
bool Rewind(char *sql, ODBCCOL *tocols); bool Rewind(char *sql, ODBCCOL *tocols);
void Close(void); void Close(void);
PQRYRES AllocateResult(PGLOBAL g);
// Attributes // Attributes
public: public:
...@@ -187,9 +188,11 @@ class ODBConn : public BLOCK { ...@@ -187,9 +188,11 @@ class ODBConn : public BLOCK {
DWORD m_UpdateOptions; DWORD m_UpdateOptions;
DWORD m_RowsetSize; DWORD m_RowsetSize;
char m_IDQuoteChar[2]; char m_IDQuoteChar[2];
int m_Catver;
PSZ m_Connect; PSZ m_Connect;
int m_Catver;
int m_Rows;
bool m_Updatable; bool m_Updatable;
bool m_Transact; bool m_Transact;
bool m_Scrollable; bool m_Scrollable;
bool m_Memory;
}; // end of ODBConn class definition }; // end of ODBConn class definition
...@@ -134,6 +134,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -134,6 +134,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if ((Scrollable = GetBoolCatInfo("Scrollable", false))) if ((Scrollable = GetBoolCatInfo("Scrollable", false)))
Elemt = 0; // Not compatible with extended fetch Elemt = 0; // Not compatible with extended fetch
Memory = GetBoolCatInfo("Memory", false);
Pseudo = 2; // FILID is Ok but not ROWID Pseudo = 2; // FILID is Ok but not ROWID
return false; return false;
} // end of DefineAM } // end of DefineAM
...@@ -198,6 +199,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp) ...@@ -198,6 +199,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
Quoted = MY_MAX(0, tdp->GetQuoted()); Quoted = MY_MAX(0, tdp->GetQuoted());
Rows = tdp->GetElemt(); Rows = tdp->GetElemt();
Catver = tdp->Catver; Catver = tdp->Catver;
Memory = (tdp->Memory) ? 1 : 0;
Scrollable = tdp->Scrollable; Scrollable = tdp->Scrollable;
} else { } else {
Connect = NULL; Connect = NULL;
...@@ -211,6 +213,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp) ...@@ -211,6 +213,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
Quoted = 0; Quoted = 0;
Rows = 0; Rows = 0;
Catver = 0; Catver = 0;
Memory = 0;
Scrollable = false; Scrollable = false;
} // endif tdp } // endif tdp
...@@ -220,6 +223,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp) ...@@ -220,6 +223,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
//Where = NULL; //Where = NULL;
MulConn = NULL; MulConn = NULL;
DBQ = NULL; DBQ = NULL;
Qrp = NULL;
Fpos = 0; Fpos = 0;
AftRows = 0; AftRows = 0;
CurNum = 0; CurNum = 0;
...@@ -238,6 +242,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp) ...@@ -238,6 +242,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
Catalog = tdbp->Catalog; Catalog = tdbp->Catalog;
Srcdef = tdbp->Srcdef; Srcdef = tdbp->Srcdef;
Qrystr = tdbp->Qrystr; Qrystr = tdbp->Qrystr;
Memory = tdbp->Memory;
Scrollable = tdbp->Scrollable; Scrollable = tdbp->Scrollable;
Quote = tdbp->Quote; Quote = tdbp->Quote;
Query = tdbp->Query; Query = tdbp->Query;
...@@ -256,6 +261,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp) ...@@ -256,6 +261,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
Rbuf = tdbp->Rbuf; Rbuf = tdbp->Rbuf;
BufSize = tdbp->BufSize; BufSize = tdbp->BufSize;
Nparm = tdbp->Nparm; Nparm = tdbp->Nparm;
Qrp = tdbp->Qrp;
} // end of TDBODBC copy constructor } // end of TDBODBC copy constructor
// Method // Method
...@@ -758,17 +764,23 @@ bool TDBODBC::OpenDB(PGLOBAL g) ...@@ -758,17 +764,23 @@ bool TDBODBC::OpenDB(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
/* Table already open, just replace it at its beginning. */ /* Table already open, just replace it at its beginning. */
/*******************************************************************/ /*******************************************************************/
// if (To_Kindex) if (Memory == 1) {
/*****************************************************************/ if ((Qrp = Ocp->AllocateResult(g)))
/* Table is to be accessed through a sorted index table. */ Memory = 2; // Must be filled
/*****************************************************************/ else
// To_Kindex->Reset(); Memory = 0; // Allocation failed, don't use it
// rewind(Stream); >>>>>>> Something to be done with Cursor <<<<<<< } else if (Memory == 2)
if (Ocp->Rewind(Query, (PODBCCOL)Columns)) { Memory = 3; // Ok to use memory result
Ocp->Close();
return true; if (Memory < 3) {
} // endif Rewind // Method will depend on cursor type
if (Ocp->Rewind(Query, (PODBCCOL)Columns)) {
Ocp->Close();
return true;
} // endif Rewind
} // endif Memory
Fpos = 0; Fpos = 0;
return false; return false;
...@@ -877,13 +889,22 @@ int TDBODBC::ReadDB(PGLOBAL g) ...@@ -877,13 +889,22 @@ int TDBODBC::ReadDB(PGLOBAL g)
/* Now start the reading process. */ /* Now start the reading process. */
/* Here is the place to fetch the line(s). */ /* Here is the place to fetch the line(s). */
/*********************************************************************/ /*********************************************************************/
if (++CurNum >= Rbuf) { if (Memory != 3) {
Rbuf = Ocp->Fetch(); if (++CurNum >= Rbuf) {
CurNum = 0; Rbuf = Ocp->Fetch();
} // endif CurNum CurNum = 0;
} // endif CurNum
rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX;
} else // Getting result from memory
rc = (Fpos < Qrp->Nblin) ? RC_OK : RC_EF;
rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX; if (rc == RC_OK) {
Fpos++; // Used for progress info if (Memory == 2)
Qrp->Nblin++;
Fpos++; // Used for memory
} // endif rc
if (trace > 1) if (trace > 1)
htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc); htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc);
...@@ -966,6 +987,7 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am) ...@@ -966,6 +987,7 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
} // endif cprec } // endif cprec
// Set additional ODBC access method information for column. // Set additional ODBC access method information for column.
Crp = NULL;
//Long = cdp->GetLong(); //Long = cdp->GetLong();
Long = Precision; Long = Precision;
//strcpy(F_Date, cdp->F_Date); //strcpy(F_Date, cdp->F_Date);
...@@ -987,6 +1009,7 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am) ...@@ -987,6 +1009,7 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
/***********************************************************************/ /***********************************************************************/
ODBCCOL::ODBCCOL(void) : COLBLK() ODBCCOL::ODBCCOL(void) : COLBLK()
{ {
Crp = NULL;
Buf_Type = TYPE_INT; // This is a count(*) column Buf_Type = TYPE_INT; // This is a count(*) column
// Set additional Dos access method information for column. // Set additional Dos access method information for column.
Long = sizeof(int); Long = sizeof(int);
...@@ -1005,6 +1028,7 @@ ODBCCOL::ODBCCOL(void) : COLBLK() ...@@ -1005,6 +1028,7 @@ ODBCCOL::ODBCCOL(void) : COLBLK()
/***********************************************************************/ /***********************************************************************/
ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp) ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
{ {
Crp = col1->Crp;
Long = col1->Long; Long = col1->Long;
//strcpy(F_Date, col1->F_Date); //strcpy(F_Date, col1->F_Date);
To_Val = col1->To_Val; To_Val = col1->To_Val;
...@@ -1070,7 +1094,20 @@ bool ODBCCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) ...@@ -1070,7 +1094,20 @@ bool ODBCCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
void ODBCCOL::ReadColumn(PGLOBAL g) void ODBCCOL::ReadColumn(PGLOBAL g)
{ {
PTDBODBC tdbp = (PTDBODBC)To_Tdb; PTDBODBC tdbp = (PTDBODBC)To_Tdb;
int n = tdbp->CurNum; int i = tdbp->Fpos - 1, n = tdbp->CurNum;
if (tdbp->Memory == 3) {
// Get the value from the stored memory
if (Crp->Nulls && Crp->Nulls[i] == '*') {
Value->Reset();
Value->SetNull(true);
} else {
Value->SetValue_pvblk(Crp->Kdata, i);
Value->SetNull(false);
} // endif Nulls
return;
} // endif Memory
if (StrLen[n] == SQL_NULL_DATA) { if (StrLen[n] == SQL_NULL_DATA) {
// Null value // Null value
...@@ -1078,7 +1115,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g) ...@@ -1078,7 +1115,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
Value->SetNull(true); Value->SetNull(true);
Value->Reset(); Value->Reset();
return; goto put;
} else } else
Value->SetNull(false); Value->SetNull(false);
...@@ -1117,6 +1154,21 @@ void ODBCCOL::ReadColumn(PGLOBAL g) ...@@ -1117,6 +1154,21 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf)); Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
} // endif Trace } // endif Trace
put:
if (tdbp->Memory != 2)
return;
/*********************************************************************/
/* Fill the allocated result structure. */
/*********************************************************************/
if (Value->IsNull()) {
if (Crp->Nulls)
Crp->Nulls[i] = '*'; // Null value
Crp->Kdata->Reset(i);
} else
Crp->Kdata->SetValue(Value, i);
} // end of ReadColumn } // end of ReadColumn
/***********************************************************************/ /***********************************************************************/
......
...@@ -60,6 +60,7 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */ ...@@ -60,6 +60,7 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
int Maxerr; /* Maxerr for an Exec table */ int Maxerr; /* Maxerr for an Exec table */
int Maxres; /* Maxres for a catalog table */ int Maxres; /* Maxres for a catalog table */
bool Scrollable; /* Use scrollable cursor */ bool Scrollable; /* Use scrollable cursor */
bool Memory; /* Put result set in memory */
bool Xsrc; /* Execution type */ bool Xsrc; /* Execution type */
}; // end of ODBCDEF }; // end of ODBCDEF
...@@ -143,7 +144,9 @@ class TDBODBC : public TDBASE { ...@@ -143,7 +144,9 @@ class TDBODBC : public TDBASE {
int Rbuf; // Number of lines read in buffer int Rbuf; // Number of lines read in buffer
int BufSize; // Size of connect string buffer int BufSize; // Size of connect string buffer
int Nparm; // The number of statement parameters int Nparm; // The number of statement parameters
int Memory; // 0: No 1: Alloc 2: Put 3: Get
bool Scrollable; // Use scrollable cursor bool Scrollable; // Use scrollable cursor
PQRYRES Qrp; // Points to storage result
}; // end of class TDBODBC }; // end of class TDBODBC
/***********************************************************************/ /***********************************************************************/
...@@ -162,6 +165,7 @@ class ODBCCOL : public COLBLK { ...@@ -162,6 +165,7 @@ class ODBCCOL : public COLBLK {
SQLLEN *GetStrLen(void) {return StrLen;} SQLLEN *GetStrLen(void) {return StrLen;}
int GetRank(void) {return Rank;} int GetRank(void) {return Rank;}
// PVBLK GetBlkp(void) {return Blkp;} // PVBLK GetBlkp(void) {return Blkp;}
void SetCrp(PCOLRES crp) {Crp = crp;}
// Methods // Methods
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
...@@ -178,6 +182,7 @@ class ODBCCOL : public COLBLK { ...@@ -178,6 +182,7 @@ class ODBCCOL : public COLBLK {
// Members // Members
TIMESTAMP_STRUCT *Sqlbuf; // To get SQL_TIMESTAMP's TIMESTAMP_STRUCT *Sqlbuf; // To get SQL_TIMESTAMP's
PCOLRES Crp; // To storage result
void *Bufp; // To extended buffer void *Bufp; // To extended buffer
PVBLK Blkp; // To Value Block PVBLK Blkp; // To Value Block
//char F_Date[12]; // Internal Date format //char F_Date[12]; // Internal Date format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment