pgadmin3/debugger/dbgModel.cpp
levinsv 4af765213c support PG11
Поддержка PostgreSQL 11 только для Windows
2018-10-10 22:59:25 +05:00

63 lines
1.5 KiB
C++

//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// dbgModel.cpp - debugger model
// - It contains the data and information related the debugging session
//
//////////////////////////////////////////////////////////////////////////
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
#include "db/pgConn.h"
#include "db/pgQueryThread.h"
#include "db/pgQueryResultEvent.h"
#include "debugger/dbgModel.h"
dbgModel::dbgModel(Oid _target, pgConn *_conn)
: m_target(NULL), m_currLineNo(-1), m_targetPid(wxT("NULL"))
{
m_target = new dbgTargetInfo(_target, _conn);
}
bool dbgModel::GetSource(const wxString &_funcOid, dbgCachedStack *_cached)
{
dbgSourceHash::iterator match = m_sourceMap.find(_funcOid);
if (match == m_sourceMap.end())
return false;
else
{
if (_cached)
{
*_cached = match->second;
}
return true;
}
}
void dbgModel::ClearCachedSource()
{
m_sourceMap.clear();
// Put a dummy entry for invalid function OID to the cache. This is
// displayed at least for inline code blocks, as we currently have no way
// to fetch the source for those
m_sourceMap[wxT("0")] = dbgCachedStack(wxT("0"), wxT("0"), wxT(""), wxT(""), _("<source not available>"));
}
void dbgModel::AddSource(const wxString &_funcOid, const dbgCachedStack &_source)
{
m_sourceMap[_funcOid] = _source;
}