Skip site navigation (1) Skip section navigation (2)

Re: PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch

From: efesar <efesar(at)nmia(dot)com>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>,Pgadmin-Hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch
Date: 2003-03-06 10:35:01
Message-ID: NGBBKFMOILMAGDABPFEGIEPDDMAA.efesar@nmia.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
> Nice work, thanks. You must have been bored :-). As you can probably
> tell I'm fairly new to C++ and still get a little confused with
> references & pointers from time to time.

Dave,

I've been programming C++ for years and I consistently have memory leaks --
especially in MFC. The really hard part about MFC is that it only takes
ownership of attached items under certain conditions (and of course since
it's Microsoft code, you never really know when that is). The really *great*
thing about wxWindows is that if you attach something to a window, dialog,
frame or control, it's deallocation is *taken care of* all the time.

> Anyway, I've applied this patch to my copy of the tree, and once I found
> the wx2.4 change you commented (downloading it now), it built OK.
> Unfortunately, I still can't get the QueryBuilder to do anything. When I
> try to add a table there are none listed - I've tried a few databases,
> all of which have a number of tables. I haven't had a chance to figure
> out what's wrong. Also, if I click the Data tab I get a parse error,
> even if I manually type in a valid query (which then vanishes).

I'm really confused as to why it's not showing any tables/views ... the
function is below. As for the SQL tab, it's one way (for now ... which
reminds me, do we have a "deconstruct sql" function lying around?) ... the
data tab calls the BuildSQL function before it gets data ... it can't get
any data unless there are some columns, and columns require tables, and as
you know ... the tables are for some strange reason not working on your
configuration.

I'm running PostgreSQL 7.3 on Cygwin so ... Maybe I misjudged the query.
Take a look at it below.

////////////////////////////////////////////////////////////////////////////
////
void dlgAddTableView::InitLists()
{
	// We need system settings
    extern sysSettings *settings;

	// We need to know if we're going to show system objects
	wxString sysobjstr;
	if (!settings->GetShowSystemObjects())
		sysobjstr = " AND relowner > 1 ";

	// Clear the lists
	m_tablelist->Clear();
	m_viewlist->Clear();

    if (m_database->Connect() == PGCONN_OK) {

		// tables
		pgSet *tables = m_database->ExecuteSet(
			wxT("SELECT oid,relname FROM pg_class "
				"WHERE relkind='r' " + sysobjstr +
				"ORDER BY lower(relname)"));

		while (!tables->Eof()) {
			m_tablelist->Append(tables->GetVal(wxT("relname")));
			tables->MoveNext();
		}

		delete tables;

		// views
		pgSet *views = m_database->ExecuteSet(
		   wxT("SELECT relname FROM pg_class "
				"WHERE relkind='v' " + sysobjstr +
				"ORDER BY lower(relname)"));

		while (!views->Eof()) {
			m_viewlist->Append(views->GetVal(wxT("relname")));
			views->MoveNext();
		}

		delete views;
    }
}
////////////////////////////////////////////////////////////////////////////
////

> The one from pgServer should *always* be the master connection (ie. The
> database in the login dialogue). Is this not the case?

Yes, that makes sense now. Since pgServer chooses the master connection, I
added the ExecuteSet command to the pgDatabase so that the user can query
the pgConn member of pgDatabase, which already has the correct database
open. That way I won't have to issue a "change database" command to
pgServer. To be honest, I don't even know how to make pgServer switch
databases.

> On another note, how did you generate the patch? I had a heck of a job
> applying it as it found files in /src but not any of the others. It's
> probably me though - I often end up battling with patch....

I'm using this program called TortoiseCVS. I can't get WinCVS to work to
save my life. Tortoise works pretty well, but I have no idea how patches
work for the most part. I just click "Make Patch" ... Since there were 6
files that were not in CVS, I zipped them in with the .patch file ... but
didn't put them into any particular subdirectories. If you have suggestions
on how to make better patches, I'll try em.

I found this document in the wxwindows domain:

http://www.wxwindows.org/technote/patches.htm

I will draw your attention to item #3: cvs diff cannot make a patch which
adds or removes a file, so you must use the standalone diff utility to do
that ...

Huh? It does my brain no justice to be up this late trying to interpret what
that means.

-Keith


In response to

pgadmin-hackers by date

Next:From: frank_lupoDate: 2003-03-06 14:40:52
Subject: Re: reindex action
Previous:From: Dave PageDate: 2003-03-06 09:22:03
Subject: Re: reindex action

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group