File: dlgDirectDbg.h

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 (126 lines) | stat: -rw-r--r-- 3,284 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// dlgDirectDbg.h - debugger
//
//////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// class dlgDirectDbg
//
//	This class implements 'direct-debugging'. In direct-debugging, the user
//  provides a function signature, procedure signature, or OID on the command
//  line (this identifies the debug target).  We query the server for the
//  names, types, and in/out modes for each target parameter and then prompt
//	the user to enter a value for each of the IN (and IN/OUT) parameters.
//
//  When the user fills in the parameter values and clicks OK, we set a
//  breakpoint at the target and then execute a SELECT statement or an
//  EXEC statement that invokes the target (with the parameter values
//  provided by the user).
//
//  A dlgDirectDbg object is typically a child of the frmDebugger object
//
////////////////////////////////////////////////////////////////////////////////

#ifndef DLGDIRECTDBG_H
#define DLGDIRECTDBG_H

#include <wx/wx.h>
#include <wx/grid.h>
#include <wx/strconv.h>

#include "dlg/dlgClasses.h"

class dbgArgInfo;
class frmDebugger;
class dbgController;

class ctlGridCellBoolEditor : public wxGridCellBoolEditor
{
public:
	ctlGridCellBoolEditor(dbgArgInfo *_arg = NULL);
	void BeginEdit (int _row, int _col, wxGrid *_grid);
	wxGridCellEditor *Clone() const;

	dbgArgInfo *GetArg()
	{
		return m_arg;
	}

private:
	dbgArgInfo *m_arg;
};

class dlgDirectDbg;

class dbgArgValueEvaluator : public wxThread
{
public:
	dbgArgValueEvaluator(pgConn *, dlgDirectDbg *);

	void *Entry();
	void  CancelEval();
	static void NoticeHandler(void *, const char *);

private:
	pgConn       *m_conn;
	dlgDirectDbg *m_dlg;

	bool          m_cancelled;
};


class dlgDirectDbg : public pgDialog
{
	DECLARE_CLASS(dlgDirectDbg)

public:
	dlgDirectDbg(frmDebugger *_parent, dbgController *_controller,
	             pgConn *_conn);

	enum
	{
	    COL_NAME = 0, // Column 0 contains the variable name
	    COL_TYPE,     // Type of column
	    COL_NULL,     // Value Set to NULL (yes/no)
	    COL_EXPR,     // Value is an expression (yes/no)
	    COL_VALUE,    // Value (constant ,or an expression)
	    COL_USE_DEF,  // Use the default value
	    COL_DEF_VAL   // Default value for the column
	};

private:

	void PopulateParamGrid();

	void OnOk(wxCommandEvent &event);
	void OnCancel(wxCommandEvent &event);
	void OnClickGridLabel(wxGridEvent &event);

	void ResultArgsUpdated(wxCommandEvent &);
	void ResultArgsUpdateError(wxCommandEvent &);

	void SaveSettings();
	void LoadSettings();
	// Function to retrive last cell value if the provieded parameter value is an invalid.
	void LoadLastCellSetting(int row_number, int array_row_number,
	                         int index_number, bool isArray);

	wxGrid *GetParamsGrid();
	bool DebugPkgConstructor();

	dbgController        *m_controller;
	pgConn               *m_conn;
	dbgArgValueEvaluator *m_thread;

	friend class dbgArgValueEvaluator;

	DECLARE_EVENT_TABLE()
};

#endif