File: dbgModel.cpp

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (63 lines) | stat: -rw-r--r-- 1,509 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, 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;
}