Version: 1.0.0
prepared_statement.cpp
Go to the documentation of this file.
1 #include "wx/database/wxprec.h"
2 
3 // ctor()
6 {
7 }
8 
9 // dtor()
11 {
12  //wxPrintf(_("~wxPreparedStatement()\n"));
14 }
15 
17 {
18  // Iterate through all of the result sets and close them all
19  StatementResultSetHashSet::iterator start = m_ResultSets.begin();
20  StatementResultSetHashSet::iterator stop = m_ResultSets.end();
21  while (start != stop)
22  {
23  //wxPrintf(_("Deleting statement result set %d\n"), (*start));
24  wxLogDebug(_("ResultSet NOT closed and cleaned up by the wxPreparedStatement dtor"));
25  delete (*start);
26  start++;
27  }
28  m_ResultSets.clear();
29 }
30 
32 {
33  if (pResultSet != NULL)
34  {
35  // Check if we have this result set in our list
36  if (m_ResultSets.find(pResultSet) != m_ResultSets.end())
37  {
38  // Remove the result set pointer from the list and delete the pointer
39  delete pResultSet;
40  m_ResultSets.erase(pResultSet);
41  return true;
42  }
43  // The result set wasn't found in the list, return false
44  return false;
45  }
46  else
47  {
48  // Return false on NULL pointer
49  return false;
50  }
51 }
52 
53 void wxPreparedStatement::SetParamBlob(int nPosition, const wxMemoryBuffer& buffer)
54 {
55  SetParamBlob(nPosition, buffer.GetData(), buffer.GetBufSize());
56 }
57 
58 
virtual bool CloseResultSet(wxDatabaseResultSet *pResultSet)
Close a result set returned by the database or a prepared statement previously.
wxPreparedStatement()
Constructor.
virtual ~wxPreparedStatement()
Destructor.
StatementResultSetHashSet m_ResultSets
void CloseResultSets()
Close all result set objects that have been generated but not yet closed.
virtual void SetParamBlob(int nPosition, const wxMemoryBuffer &buffer)
Set the parameter at the 1-based position to a Blob value.