Update of /cvsroot/myoledb/myoledb3
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28887
Modified Files:
command.cpp command.h
Log Message:
If the statement fails, make sure ppRowset is set to NULL, so we won't think we have a valid rowset
Keep a record of whether a statement succeeds, so we can return E_FAIL if it failed when asked for the rows
Index: command.h
===================================================================
RCS file: /cvsroot/myoledb/myoledb3/command.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- command.h 20 Sep 2005 14:44:33 -0000 1.1.1.1
+++ command.h 1 Feb 2006 07:24:29 -0000 1.2
@@ -117,6 +117,9 @@
PIMPICOLUMNSINFO m_pIColumnsInfo;
//@member contained ISupportErrorInfo
PIMPISUPPORTERRORINFO m_pISupportErrorInfo;
+
+ //@member record of whetehr the statement failed (and the Rowset is NULL for that reason) or succeeded
+ bool m_bStatementFailed;
public: //@access public
//@cmember Constructor
Index: command.cpp
===================================================================
RCS file: /cvsroot/myoledb/myoledb3/command.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- command.cpp 24 Jan 2006 12:01:55 -0000 1.5
+++ command.cpp 1 Feb 2006 07:24:28 -0000 1.6
@@ -46,6 +46,7 @@
m_pUnkOuter = pUnkOuter ? pUnkOuter : this;
m_cCols = -1;
m_bBookmark = true;
+ m_bStatementFailed = true;
// Increment global object count.
OBJECT_CONSTRUCTED();
@@ -546,16 +547,10 @@
// NEVER EXECUTE THE STATEMENT!! This causes side-effects
if (pRowset == NULL)
{
- /*HRESULT hr;
- hr = ((CImpICommand*)m_pICommand)->Execute(NULL, IID_IUnknown, NULL, NULL, (IUnknown**)&pRowset);
- if (FAILED(hr))
- return E_FAIL; //hr
-
- if (pRowset == NULL)
- {*/
- m_cCols = 0;
- return S_OK;
- /*}*/
+ if (m_bStatementFailed)
+ return E_FAIL;
+ m_cCols = 0;
+ return S_OK;
}
else
pRowset->AddRef();
@@ -1024,12 +1019,14 @@
*pcRowsAffected = dwAffectedRows;
delete pData;
+ m_pObj->m_bStatementFailed = false;
return S_OK;
}
if (riid == GUID_NULL)
{
delete pData;
+ m_pObj->m_bStatementFailed = false;
return S_OK;
}
@@ -1110,12 +1107,14 @@
if (FAILED( hr ))
{
delete pRowset;
+ *ppRowset = NULL;
return hr;
}
hr = m_pObj->FillColumnInfo(pRowset);
if (FAILED(hr))
{
+ *ppRowset = NULL;
delete pRowset;
return hr;
}
@@ -1143,6 +1142,7 @@
hr = pRowset->m_pExtBufferAccessor->InsertIntoExtBuffer(&pAccessor, ulTemp);
if (FAILED(hr))
{
+ *ppRowset = NULL;
delete pRowset;
if (pAccessor != NULL)
@@ -1175,7 +1175,8 @@
m_pObj->SetState(STATE_EXECUTE);
- return hr;
+ m_pObj->m_bStatementFailed = false;
+ return hr;
INTERFACE_METHOD_END();
}
|