Thread: Patch: Query favourites

Patch: Query favourites

From
"Magnus Hagander"
Date:
This patch adds a favourites menu to the query tool, where one can store
often-used queries.

It brings along build dependencies on wxxml2
(http://wxcode.sourceforge.net/components/wxxml2/) and libxml2 (which
comes from the first). These dliver general XML support, which I'm sure
will be useful for a lot of other things as well - I'm already looking a
bit at some xml import/export functions that I'd like to integrate with
pgadmin, and that's just one thing. I think it'd be good in general to
have it.

The package builds easily with configure/make/make install on unix (at
one point I had to do a fromdos on the configure file, but I thin kthat
was because I dl:ed the wrong package). On windows, there are build
files for VS that worked fine in VS2003. Don't have VS6 around to test
it with.

Attached is one patch that is the actual functionality, and one against
the Unix build system. I'm no autoconf master by far, so that one may be
a bit off ;-) As said before, I don't have VS6 so I haven't got a patch
for that one. It should be a trivial matter of adding the files to the
project, though, and disabling PCH for the favourites.cpp file due to
version conflicts between wxxml and wxxml2.

Tested on win32, and a bit on linux (slackware on developer.pgadmin.org)
but not as much.

//Magnus

Attachment

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Magnus Hagander wrote:

>This patch adds a favourites menu to the query tool, where one can store
>often-used queries.
>
>It brings along build dependencies on wxxml2
>(http://wxcode.sourceforge.net/components/wxxml2/) and libxml2 (which
>comes from the first).
>
The tradeoff between additional benefit (you can already store
often-used queries in standard files) and increased wx dependencies
(actually not wx but wxcode, which can make it a nightmare dealing with
distributions) makes this patch really expensive. IMNSHO, too expensive.

Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> >This patch adds a favourites menu to the query tool, where one can
> >store often-used queries.
> >
> >It brings along build dependencies on wxxml2
> >(http://wxcode.sourceforge.net/components/wxxml2/) and
> libxml2 (which
> >comes from the first).
> >
> The tradeoff between additional benefit (you can already
> store often-used queries in standard files) and increased wx
> dependencies (actually not wx but wxcode, which can make it a
> nightmare dealing with
> distributions) makes this patch really expensive. IMNSHO, too
> expensive.

Seems I cause a lot of nightmares these days.

Anyway, it could be rewritten to either not use XML at all, or to not
use wxxml (say by linking directly to libxml, which is likely to be on
the system already considering how many packages use it). It just makes
it easier when you don't have to maintain the code youself.

Using xml makes it a whole lot easier (no need to deal with escaping,
structuring, etc yourself), especially if you can foresee other places
to use it. But it's by no means a requirement.

As for the fact that you can already store them in standard files - sure
you can. It's a matter of convenience. If we don't care about
convenience, we can just use psql and get rid of most of pgadmin. (which
I don't think is a good idea, btw. Convenience is, imho, what pgadmin is
supposed to be all about)

//Magnus

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Magnus Hagander wrote:

>
>Anyway, it could be rewritten to either not use XML at all, or to not
>use wxxml (say by linking directly to libxml, which is likely to be on
>the system already considering how many packages use it). It just makes
>it easier when you don't have to maintain the code youself.
>
>
There must be some XML stuff in std wx, since XRC uses XML, dunno how
reusable that is.

>As for the fact that you can already store them in standard files - sure
>you can. It's a matter of convenience.
>
Still appears as a duplication of features. What's wrong with "recent
files"?
Actually, I'd like it better to have a means of adding macros/scripts or
so to pgAdmin, i.e. wxPython. This would enable pgAdmin extensions,
keeping the pgAdmin core relatively pure.

Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> >Anyway, it could be rewritten to either not use XML at all,
> or to not
> >use wxxml (say by linking directly to libxml, which is
> likely to be on
> >the system already considering how many packages use it). It
> just makes
> >it easier when you don't have to maintain the code youself.
> >
> >
> There must be some XML stuff in std wx, since XRC uses XML,
> dunno how reusable that is.

It specifically says that the API is not stable and should not be used.
(http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/include/wx/xml/xml.h?rev
=1.5&content-type=text/vnd.viewcvs-markup and friends)



> >As for the fact that you can already store them in standard files -
> >sure you can. It's a matter of convenience.
> >
> Still appears as a duplication of features. What's wrong with
> "recent files"?

No hierarchy, very very limited number of entries, no control over which
entries go on the list (say when you open a one-time file to run, it
will still steal a position on the list), no ability to add descriptive
entries. I'm sure there are more, but that's what I came up with whlie
typing without needing to think about it.


> Actually, I'd like it better to have a means of adding
> macros/scripts or so to pgAdmin, i.e. wxPython. This would
> enable pgAdmin extensions, keeping the pgAdmin core relatively pure.

Sure, that'd be nice. Still, that adds a dependency on *python*, which
is *huge* compared to wxxml...

And I don't see the point in this case. Yes, macro etc would be great
functionality, but it's not a replacement for builtin features. If it
was, why not rewrite pgadmin in python?


//Magnus

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Magnus Hagander wrote:

>>>Anyway, it could be rewritten to either not use XML at all,
>>>
>>>
>>or to not
>>
>>
>>>use wxxml (say by linking directly to libxml, which is
>>>
>>>
>>likely to be on
>>
>>
>>>the system already considering how many packages use it). It
>>>
>>>
>>just makes
>>
>>
>>>it easier when you don't have to maintain the code youself.
>>>
>>>
>>>
>>>
>>There must be some XML stuff in std wx, since XRC uses XML,
>>dunno how reusable that is.
>>
>>
>
>It specifically says that the API is not stable and should not be used.
>(http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/include/wx/xml/xml.h?rev
>=1.5&content-type=text/vnd.viewcvs-markup and friends)
>
>
>
>
>
>>>As for the fact that you can already store them in standard files -
>>>sure you can. It's a matter of convenience.
>>>
>>>
>>>
>>Still appears as a duplication of features. What's wrong with
>>"recent files"?
>>
>>
>
>No hierarchy, very very limited number of entries, no control over which
>entries go on the list (say when you open a one-time file to run, it
>will still steal a position on the list), no ability to add descriptive
>entries. I'm sure there are more, but that's what I came up with whlie
>typing without needing to think about it.
>
>
>
>
>>Actually, I'd like it better to have a means of adding
>>macros/scripts or so to pgAdmin, i.e. wxPython. This would
>>enable pgAdmin extensions, keeping the pgAdmin core relatively pure.
>>
>>
>
>Sure, that'd be nice. Still, that adds a dependency on *python*, which
>is *huge* compared to wxxml...
>
>
I don't mind adding dependencies if benefits are huge (last addition was
OGL for graphical explain, which is a std wx contrib module). The few
preferred queries I'm using are in some files, and I simply mark and
execute them. That's why I can't see any benefit from such a "favourite"
feature.


>And I don't see the point in this case.
>
The point is, the scripting option I'm thinking of would allow you to
declare your own menu entry for your preferred query (which might
consist of a dialogue, formatting your result) so it's not the query
you're storing, but but the feature/task/whatever. Just as we have a
status display, not just a favourite "select * from pg_status".

Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> >>Actually, I'd like it better to have a means of adding
> macros/scripts
> >>or so to pgAdmin, i.e. wxPython. This would enable pgAdmin
> extensions,
> >>keeping the pgAdmin core relatively pure.
> >>
> >>
> >
> >Sure, that'd be nice. Still, that adds a dependency on
> *python*, which
> >is *huge* compared to wxxml...
> >
> >
> I don't mind adding dependencies if benefits are huge (last
> addition was OGL for graphical explain, which is a std wx
> contrib module). The few preferred queries I'm using are in
> some files, and I simply mark and execute them. That's why I
> can't see any benefit from such a "favourite"
> feature.

On this we clearly disagree (on the value of the feature, that is). But
that's your choice, of course. I'll keep running with it myself until
such a time as an alternative exists.
Let's, as they say, agree to disagree on it.


> >And I don't see the point in this case.
> >
> The point is, the scripting option I'm thinking of would
> allow you to declare your own menu entry for your preferred
> query (which might consist of a dialogue, formatting your
> result) so it's not the query you're storing, but but the
> feature/task/whatever. Just as we have a status display, not
> just a favourite "select * from pg_status".

Oh, ok. Then I see what you mean. I still don't see it as a clear
replacement, but it would certainly a good feature.

//Magnus

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Magnus Hagander
> Sent: 29 January 2006 20:56
> To: Andreas Pflug
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
> On this we clearly disagree (on the value of the feature,
> that is). But
> that's your choice, of course. I'll keep running with it myself until
> such a time as an alternative exists.
> Let's, as they say, agree to disagree on it.

FWIW, I do think this would be a nice feature, and would tie in nicely
with an idea I've been mulling over of having a centralised library site
for SQL snippets.

However, I did just download wxxml2 to give it a go and instantly ran
into problems building it on Windows. I'm sure I could get over them
with a little effort, but a little effort for me to build probably means
a lot more effort helping others in the future :-(

How much work would it be to use libxml2/msxml - assuming you are
*definitely* going to be working on some XML import/export features that
we agree would be accepted in principle?

Regards, Dave.

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Dave Page wrote:
>
>
>
>>-----Original Message-----
>>From: pgadmin-hackers-owner@postgresql.org
>>[mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
>>Magnus Hagander
>>Sent: 29 January 2006 20:56
>>To: Andreas Pflug
>>Cc: pgadmin-hackers@postgresql.org
>>Subject: Re: [pgadmin-hackers] Patch: Query favourites
>>
>>On this we clearly disagree (on the value of the feature,
>>that is). But
>>that's your choice, of course. I'll keep running with it myself until
>>such a time as an alternative exists.
>>Let's, as they say, agree to disagree on it.
>
>
> FWIW, I do think this would be a nice feature, and would tie in nicely
> with an idea I've been mulling over of having a centralised library site
> for SQL snippets.

As we now have a postgres database, this should be the central
repository for stuff like this. No need for XML here...

Regards,
Andreas

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 30 January 2006 14:10
> To: Dave Page
> Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
> > FWIW, I do think this would be a nice feature, and would
> tie in nicely
> > with an idea I've been mulling over of having a centralised
> library site
> > for SQL snippets.
>
> As we now have a postgres database, this should be the central
> repository for stuff like this. No need for XML here...

No, centralised as in we host it. And no, it wouldn't need XML; I just
mean the favourites feature would fit in nicely.

Regards, Dave.

Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> >>On this we clearly disagree (on the value of the feature, that is).
> >>But that's your choice, of course. I'll keep running with it myself
> >>until such a time as an alternative exists.
> >>Let's, as they say, agree to disagree on it.
> >
> >
> > FWIW, I do think this would be a nice feature, and would
> tie in nicely
> > with an idea I've been mulling over of having a centralised library
> > site for SQL snippets.
>
> As we now have a postgres database, this should be the
> central repository for stuff like this. No need for XML here...

Using the postgres database ties me to one server. I run the same
queries against many different servers - which one are you going to
store them in?

//Magnus

Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> > On this we clearly disagree (on the value of the feature, that is).
> > But that's your choice, of course. I'll keep running with it myself
> > until such a time as an alternative exists.
> > Let's, as they say, agree to disagree on it.
>
> FWIW, I do think this would be a nice feature, and would tie
> in nicely with an idea I've been mulling over of having a
> centralised library site for SQL snippets.
>
> However, I did just download wxxml2 to give it a go and
> instantly ran into problems building it on Windows. I'm sure
> I could get over them with a little effort, but a little
> effort for me to build probably means a lot more effort
> helping others in the future :-(
>
> How much work would it be to use libxml2/msxml - assuming you are
> *definitely* going to be working on some XML import/export
> features that we agree would be accepted in principle?

Reasonably easy, considering we're not really using much of the XML
functionality ATM. We don't even need to do a "proper abstraction", we
could just write code that uses libxml directly. (Or perhaps with simple
wrappers around some parts, but not all).


As for the libxml2/msxml - I think going with *just* libxml2 is the way
to go. The APIs are so completely different that it would be two
completely different implementations. And AFAIK, there are no problems
with libxml on Win32 in general.

So yeah, that can definitly be done without an unreasonable amount of
work. If that means that the feature will "live", I'm fine with looking
at that. But I'd like to know that first. (Implementation details aside
of course, there can still be more of those to fix - the feature in
principle, and the general idea of storing the data in a file in the
users homedir etc)

//Magnus

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Magnus Hagander wrote:

>
>As for the libxml2/msxml - I think going with *just* libxml2 is the way
>to go. The APIs are so completely different that it would be two
>completely different implementations. And AFAIK, there are no problems
>with libxml on Win32 in general.
>
>
except for libxml2 not being there by default.

>So yeah, that can definitly be done without an unreasonable amount of
>work. If that means that the feature will "live", I'm fine with looking
>at that. But I'd like to know that first. (Implementation details aside
>of course, there can still be more of those to fix - the feature in
>principle, and the general idea of storing the data in a file in the
>users homedir etc)
>
>
I don't like storing more stuff in files, and in  homedir even less. I
even don't like registry/.pgadmin3 (not completely replacable), and
would like some network (db) based solution to copy server connect
strings from.

Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> >As for the libxml2/msxml - I think going with *just* libxml2
> is the way
> >to go. The APIs are so completely different that it would be two
> >completely different implementations. And AFAIK, there are
> no problems
> >with libxml on Win32 in general.
> >
> >
> except for libxml2 not being there by default.

Neither is wx or libpq, but that doesn't cause a problem. Link with it
statically, and the user will never know.


> >So yeah, that can definitly be done without an unreasonable
> amount of
> >work. If that means that the feature will "live", I'm fine
> with looking
> >at that. But I'd like to know that first. (Implementation
> details aside
> >of course, there can still be more of those to fix - the feature in
> >principle, and the general idea of storing the data in a file in the
> >users homedir etc)
> >
> >
> I don't like storing more stuff in files, and in  homedir
> even less. I even don't like registry/.pgadmin3 (not
> completely replacable), and would like some network (db)
> based solution to copy server connect strings from.

I personally think that's a bad idea. Especially for the config stuff.
For favourites, I can see a point in being able to put it centrally - as
an option. Then again, storing it in the home directory will make it
roam, and that makes it central enough for me.

//Magnus

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Magnus Hagander [mailto:mha@sollentuna.net]
> Sent: 30 January 2006 20:22
> To: Dave Page; Andreas Pflug
> Cc: pgadmin-hackers@postgresql.org
> Subject: RE: [pgadmin-hackers] Patch: Query favourites
>
> As for the libxml2/msxml - I think going with *just* libxml2
> is the way
> to go. The APIs are so completely different that it would be two
> completely different implementations. And AFAIK, there are no problems
> with libxml on Win32 in general.

OK, I'll give it a go if I get 5 minutes.

> So yeah, that can definitly be done without an unreasonable amount of
> work. If that means that the feature will "live", I'm fine
> with looking
> at that. But I'd like to know that first. (Implementation
> details aside
> of course, there can still be more of those to fix - the feature in
> principle, and the general idea of storing the data in a file in the
> users homedir etc)

I like the idea, and agree with storing the data in the user's home
directory. The data is definitely going to be too large to store
sensibly in the registry or an ini file, and storing in the master
database restricts you to a single server which, like you, would not
help me much.

Regards, Dave.

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Dave Page wrote:
>
>
>
>>-----Original Message-----
>>From: Magnus Hagander [mailto:mha@sollentuna.net]
>>Sent: 30 January 2006 20:22
>>To: Dave Page; Andreas Pflug
>>Cc: pgadmin-hackers@postgresql.org
>>Subject: RE: [pgadmin-hackers] Patch: Query favourites
>>
>>As for the libxml2/msxml - I think going with *just* libxml2
>>is the way
>>to go. The APIs are so completely different that it would be two
>>completely different implementations. And AFAIK, there are no problems
>>with libxml on Win32 in general.
>
>
> OK, I'll give it a go if I get 5 minutes.
>
>
>>So yeah, that can definitly be done without an unreasonable amount of
>>work. If that means that the feature will "live", I'm fine
>>with looking
>>at that. But I'd like to know that first. (Implementation
>>details aside
>>of course, there can still be more of those to fix - the feature in
>>principle, and the general idea of storing the data in a file in the
>>users homedir etc)
>
>
> I like the idea, and agree with storing the data in the user's home
> directory. The data is definitely going to be too large to store
> sensibly in the registry or an ini file, and storing in the master
> database restricts you to a single server which, like you, would not
> help me much.

I didn't think of one repository per server, but a dedicated repository
server. This would allow roaming regardless of operating systems.

Regards,
Andresa

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 31 January 2006 12:19
> To: Dave Page
> Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
>
> I didn't think of one repository per server, but a dedicated
> repository
> server. This would allow roaming regardless of operating systems.

That's not a bad idea, but it does introduce a whole new level of
setup/configuration for the user - perhaps something to consider more
fully along with the pgAgent setup.

Regards, Dave

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Dave Page wrote:

>
>
>
>
>>-----Original Message-----
>>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
>>Sent: 31 January 2006 12:19
>>To: Dave Page
>>Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
>>Subject: Re: [pgadmin-hackers] Patch: Query favourites
>>
>>
>>I didn't think of one repository per server, but a dedicated
>>repository
>>server. This would allow roaming regardless of operating systems.
>>
>>
>
>That's not a bad idea, but it does introduce a whole new level of
>setup/configuration for the user - perhaps something to consider more
>fully along with the pgAgent setup.
>
>
Hm, don't see the connection to pgAgent.
What I was thinking of is an option "repository server/db". E.g. when
creating a new connection, instead of entering data manually info can be
retrieved from repository.

Regards,
Andreas


Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 31 January 2006 16:27
> To: Dave Page
> Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
> Hm, don't see the connection to pgAgent.
> What I was thinking of is an option "repository server/db". E.g. when
> creating a new connection, instead of entering data manually
> info can be
> retrieved from repository.

If we are going to have central repository of some description, then
perhaps we should have a wizard to create it for the user. That Wizard
could be used to setup the favourites repository, the connection
repository, the pgAgent schema and so on, each of which could be setup
on one or more servers as required by the user and appropriate for the
type of repository (or whatever).

Regards, Dave

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Dave Page wrote:

>
>
>
>
>>-----Original Message-----
>>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
>>Sent: 31 January 2006 16:27
>>To: Dave Page
>>Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
>>Subject: Re: [pgadmin-hackers] Patch: Query favourites
>>
>>Hm, don't see the connection to pgAgent.
>>What I was thinking of is an option "repository server/db". E.g. when
>>creating a new connection, instead of entering data manually
>>info can be
>>retrieved from repository.
>>
>>
>
>If we are going to have central repository of some description, then
>perhaps we should have a wizard to create it for the user. That Wizard
>could be used to setup the favourites repository, the connection
>repository, the pgAgent schema and so on, each of which could be setup
>on one or more servers as required by the user and appropriate for the
>type of repository (or whatever).
>

Agreeeeed. There's no reason why we can create a Slony cluster from
pgAdmin, but not the pgAgent schema (or a future repository schema).

Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> > As for the libxml2/msxml - I think going with *just* libxml2 is the
> > way to go. The APIs are so completely different that it
> would be two
> > completely different implementations. And AFAIK, there are
> no problems
> > with libxml on Win32 in general.

Here's a version that uses libxml2 natively, including updated unix
build scripts. No longer any dependency on wxxml2.

//Magnus

Attachment

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Magnus Hagander [mailto:mha@sollentuna.net]
> Sent: 01 February 2006 18:59
> To: Dave Page; Andreas Pflug
> Cc: pgadmin-hackers@postgresql.org
> Subject: RE: [pgadmin-hackers] Patch: Query favourites
>
> > > As for the libxml2/msxml - I think going with *just*
> libxml2 is the
> > > way to go. The APIs are so completely different that it
> > would be two
> > > completely different implementations. And AFAIK, there are
> > no problems
> > > with libxml on Win32 in general.
>
> Here's a version that uses libxml2 natively, including updated unix
> build scripts. No longer any dependency on wxxml2.

Finally got around to looking at this :-). Couple of things I noticed:

- If the ctlSQLBox is empty, the 'Add Favourites' option is still
enabled, but does nothing. SVN trunk calls updateMenu (or whatever it's
called) on every change now, so this should be a 30 second fix.

- On Linux, with no favourites at all, the root node in the Manage
Favourites tree has no icon. Add a favourite, and the root node gains a
folder icon, but the favourites themselves remain without an icon. Works
properly on Windows, haven't tried Mac.

- You can only create one new folder on the manage dialogue. To create
mode, you need to close/re-open the dialogue.

- You can create folders with duplicate names in the same folder. Is
this a bug? Dunno...

- The buttons on the manage dialogue should left-align with the side of
the tree control.

- There is no doc update. An update to the build instructions on the
website would also be nice :-)

On a related note, this introduces dependencies on libxml2 and iconv.
These are both available from www.xmlsoft.org, precompiled for Windows,
and are both on most unixes already, however, on Windows there is no
standard place for them to live. There are two sensible options I can
see for these, and wxWidgets:

C:\wxWidgets-2.6\
C:\libxml2\
C:\iconv\

Or

C:\pgadmin-prereqs (or some other name)
      \wxWidgets-2.6\
      \libxml2\
      \iconv\

Thoughts/preferences?

Regards, Dave.

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of Dave Page
> Sent: 07 February 2006 13:03
> To: Magnus Hagander; Andreas Pflug
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
>
> Finally got around to looking at this :-). Couple of things I noticed:

Ooops, forgot one - I get:

precomp.cpp
c:\documents and settings\dpage\my
documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
return type for 'queryFavouriteArray::reverse_iterator::operator ->' is
'class queryFavouriteItem ** ' (ie; not a UDT or reference to a UDT.
Wil
l produce errors if applied using infix notation)
c:\documents and settings\dpage\my
documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
return type for 'queryFavouriteArray::const_reverse_iterator::operator
->' is 'class queryFavouriteItem *const * ' (ie; not a UDT or reference
to
 a UDT.  Will produce errors if applied using infix notation)

Compiling in VC++ 6.0

/D

Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> > > > As for the libxml2/msxml - I think going with *just*
> > libxml2 is the
> > > > way to go. The APIs are so completely different that it
> > > would be two
> > > > completely different implementations. And AFAIK, there are
> > > no problems
> > > > with libxml on Win32 in general.
> >
> > Here's a version that uses libxml2 natively, including updated unix
> > build scripts. No longer any dependency on wxxml2.
>
> Finally got around to looking at this :-). Couple of things I noticed:
>
> - If the ctlSQLBox is empty, the 'Add Favourites' option is
> still enabled, but does nothing. SVN trunk calls updateMenu
> (or whatever it's
> called) on every change now, so this should be a 30 second fix.

Indeed. Tried that before, had the problem that it didn't activate,
couldn't figure out why. Seems you've fixed that one, so yes, 30 second
fix.


> - On Linux, with no favourites at all, the root node in the
> Manage Favourites tree has no icon. Add a favourite, and the
> root node gains a folder icon, but the favourites themselves
> remain without an icon. Works properly on Windows, haven't tried Mac.

Ah. Turns out there is a default image for a tree node when running on
Windows, but not when running on Linux. Cross-platform? Hmm... Fixed.


> - You can only create one new folder on the manage dialogue.
> To create mode, you need to close/re-open the dialogue.

Major logic bomb. Actually, could create more than one subfolder - as
long as the new one was added to a *different* one. It overwrote the
treeid of the parent folder instead of the child...
Along this, also fixed a bug with empty folders.


> - You can create folders with duplicate names in the same
> folder. Is this a bug? Dunno...

Dunno either, but it seems stupid. So now it refuses it.


> - The buttons on the manage dialogue should left-align with
> the side of the tree control.

Yeah. Fixed.


> - There is no doc update. An update to the build instructions
> on the website would also be nice :-)

Hmm. It was included in the first one, missed it in the libxml version.
Included again in this one.

Build instructions attached as a separate patch. Don't have an env to
test it in, but it should be simple 'nuf.


> On a related note, this introduces dependencies on libxml2 and iconv.
> These are both available from www.xmlsoft.org, precompiled
> for Windows, and are both on most unixes already, however, on
> Windows there is no standard place for them to live. There
> are two sensible options I can see for these, and wxWidgets:
>
> C:\wxWidgets-2.6\
> C:\libxml2\
> C:\iconv\
>
> Or
>
> C:\pgadmin-prereqs (or some other name)
>       \wxWidgets-2.6\
>       \libxml2\
>       \iconv\
>
> Thoughts/preferences?

I like the latter. Even better if it could be made a relative directory
wrt to the pgadmin directory. Say I have c:\src, then I could have
c:\src\pgadmin3 and c:\src\pgamdin-preqreqs. Or so.

> Ooops, forgot one - I get:
>
> precomp.cpp
> c:\documents and settings\dpage\my
> documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
> return type for
> 'queryFavouriteArray::reverse_iterator::operator ->' is
> 'class queryFavouriteItem ** ' (ie; not a UDT or reference to a UDT.
> Wil
> l produce errors if applied using infix notation)
> c:\documents and settings\dpage\my
> documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
> return type for 'queryFavouriteArray::const_reverse_iterator::operator
> ->' is 'class queryFavouriteItem *const * ' (ie; not a UDT or
> reference
> to
>  a UDT.  Will produce errors if applied using infix notation)
>
> Compiling in VC++ 6.0

Doesn't show up in VC7 or GCC. Google told me to use
WX_DEFINE_ARRAY_PTR() instead of WX_DEFINE_ARRAY(). Can't test it
though. (Google also says the warning is harmless, but if there is a way
to make it go away it should be done)


Unix build system patch unchanged and thus not included.

//Magnus

Attachment

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Magnus Hagander wrote:
>
>
>> On a related note, this introduces dependencies on libxml2 and iconv.
>> These are both available from www.xmlsoft.org, precompiled
>> for Windows, and are both on most unixes already, however, on
>> Windows there is no standard place for them to live. There
>> are two sensible options I can see for these, and wxWidgets:
>>
>> C:\wxWidgets-2.6\
>> C:\libxml2\
>> C:\iconv\
>>
>> Or
>>
>> C:\pgadmin-prereqs (or some other name)
>>       \wxWidgets-2.6\
>>       \libxml2\
>>       \iconv\
>>
>> Thoughts/preferences?
>>
>
>
Wish we had easy soft links under win32...
> I like the latter. Even better if it could be made a relative directory
> wrt to the pgadmin directory. Say I have c:\src, then I could have
> c:\src\pgadmin3 and c:\src\pgamdin-preqreqs. Or so.
>
>
+1.
Relative path should consider the multi-version situation (1.4 and
HEAD). So the path should be something like ../pga-prereq. I wonder if
VCxx will work correctly with that.


Regards,
Andreas


Re: Patch: Query favourites

From
"Dave Page"
Date:

-----Original Message-----
From: "Andreas Pflug"<pgadmin@pse-consulting.de>
Sent: 07/02/06 22:02:37
To: "Magnus Hagander"<mha@sollentuna.net>
Cc: "Dave Page"<dpage@vale-housing.co.uk>, "pgadmin-hackers@postgresql.org"<pgadmin-hackers@postgresql.org>
Subject: Re: [pgadmin-hackers] Patch: Query favourites

> So the path should be something like
> ../pga-prereq. I wonder if
> VCxx will work correctly with that.

Yes, that was what I had in mind following Magnus' comments. I'll try it tomorrow.

/D

-----Unmodified Original Message-----
Magnus Hagander wrote:
>
>
>> On a related note, this introduces dependencies on libxml2 and iconv.
>> These are both available from www.xmlsoft.org, precompiled
>> for Windows, and are both on most unixes already, however, on
>> Windows there is no standard place for them to live. There
>> are two sensible options I can see for these, and wxWidgets:
>>
>> C:\wxWidgets-2.6\
>> C:\libxml2\
>> C:\iconv\
>>
>> Or
>>
>> C:\pgadmin-prereqs (or some other name)
>>       \wxWidgets-2.6\
>>       \libxml2\
>>       \iconv\
>>
>> Thoughts/preferences?
>>
>
>
Wish we had easy soft links under win32...
> I like the latter. Even better if it could be made a relative directory
> wrt to the pgadmin directory. Say I have c:\src, then I could have
> c:\src\pgadmin3 and c:\src\pgamdin-preqreqs. Or so.
>
>
+1.
Relative path should consider the multi-version situation (1.4 and
HEAD). So the path should be something like ../pga-prereq. I wonder if
VCxx will work correctly with that.


Regards,
Andreas


Re: Patch: Query favourites

From
"Magnus Hagander"
Date:
> Wish we had easy soft links under win32...
> > I like the latter. Even better if it could be made a relative
> > directory wrt to the pgadmin directory. Say I have c:\src, then I
> > could have
> > c:\src\pgadmin3 and c:\src\pgamdin-preqreqs. Or so.
> >
> >
> +1.
> Relative path should consider the multi-version situation
> (1.4 and HEAD). So the path should be something like
> ../pga-prereq. I wonder if VCxx will work correctly with that.

Can't speak for VS6, but VS2003 certainly does. I use it all the time
for requirements. It'll even stick the relative paths in there by
default when you use the GUI to add it.

//Magnus

Re: Patch: Query favourites

From
"Dave Page"
Date:
Patch applied with the following changes:

- Moved all deps to $PGASRC/../pgadmin3-deps/ on Windows.
- Replaced the wxTreeCtrl with a ctlTree (which draws lines properly on
GTK), and added the appropriate XRC resource handlers.

There is a slightly odd effect with the text box on dlgAddFavourite and
the wxTextEntry dialogue on Windows in which the cursor keeps returning
to immediately before char 4 (even if the textbox is actually empty),
but it does actually work as expected.

Andreas; can you look at that please? I'm somewhat baffled...

Regards, Dave

> -----Original Message-----
> From: Magnus Hagander [mailto:mha@sollentuna.net]
> Sent: 07 February 2006 20:05
> To: Dave Page
> Cc: pgadmin-hackers@postgresql.org
> Subject: RE: [pgadmin-hackers] Patch: Query favourites
>
> > > > > As for the libxml2/msxml - I think going with *just*
> > > libxml2 is the
> > > > > way to go. The APIs are so completely different that it
> > > > would be two
> > > > > completely different implementations. And AFAIK, there are
> > > > no problems
> > > > > with libxml on Win32 in general.
> > >
> > > Here's a version that uses libxml2 natively, including
> updated unix
> > > build scripts. No longer any dependency on wxxml2.
> >
> > Finally got around to looking at this :-). Couple of things
> I noticed:
> >
> > - If the ctlSQLBox is empty, the 'Add Favourites' option is
> > still enabled, but does nothing. SVN trunk calls updateMenu
> > (or whatever it's
> > called) on every change now, so this should be a 30 second fix.
>
> Indeed. Tried that before, had the problem that it didn't activate,
> couldn't figure out why. Seems you've fixed that one, so yes,
> 30 second
> fix.
>
>
> > - On Linux, with no favourites at all, the root node in the
> > Manage Favourites tree has no icon. Add a favourite, and the
> > root node gains a folder icon, but the favourites themselves
> > remain without an icon. Works properly on Windows, haven't
> tried Mac.
>
> Ah. Turns out there is a default image for a tree node when running on
> Windows, but not when running on Linux. Cross-platform? Hmm... Fixed.
>
>
> > - You can only create one new folder on the manage dialogue.
> > To create mode, you need to close/re-open the dialogue.
>
> Major logic bomb. Actually, could create more than one subfolder - as
> long as the new one was added to a *different* one. It overwrote the
> treeid of the parent folder instead of the child...
> Along this, also fixed a bug with empty folders.
>
>
> > - You can create folders with duplicate names in the same
> > folder. Is this a bug? Dunno...
>
> Dunno either, but it seems stupid. So now it refuses it.
>
>
> > - The buttons on the manage dialogue should left-align with
> > the side of the tree control.
>
> Yeah. Fixed.
>
>
> > - There is no doc update. An update to the build instructions
> > on the website would also be nice :-)
>
> Hmm. It was included in the first one, missed it in the
> libxml version.
> Included again in this one.
>
> Build instructions attached as a separate patch. Don't have an env to
> test it in, but it should be simple 'nuf.
>
>
> > On a related note, this introduces dependencies on libxml2
> and iconv.
> > These are both available from www.xmlsoft.org, precompiled
> > for Windows, and are both on most unixes already, however, on
> > Windows there is no standard place for them to live. There
> > are two sensible options I can see for these, and wxWidgets:
> >
> > C:\wxWidgets-2.6\
> > C:\libxml2\
> > C:\iconv\
> >
> > Or
> >
> > C:\pgadmin-prereqs (or some other name)
> >       \wxWidgets-2.6\
> >       \libxml2\
> >       \iconv\
> >
> > Thoughts/preferences?
>
> I like the latter. Even better if it could be made a relative
> directory
> wrt to the pgadmin directory. Say I have c:\src, then I could have
> c:\src\pgadmin3 and c:\src\pgamdin-preqreqs. Or so.
>
> > Ooops, forgot one - I get:
> >
> > precomp.cpp
> > c:\documents and settings\dpage\my
> > documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
> > return type for
> > 'queryFavouriteArray::reverse_iterator::operator ->' is
> > 'class queryFavouriteItem ** ' (ie; not a UDT or reference to a UDT.
> > Wil
> > l produce errors if applied using infix notation)
> > c:\documents and settings\dpage\my
> > documents\svn\pgadmin3\src\include\favourites.h(43) : warning C4284:
> > return type for
> 'queryFavouriteArray::const_reverse_iterator::operator
> > ->' is 'class queryFavouriteItem *const * ' (ie; not a UDT or
> > reference
> > to
> >  a UDT.  Will produce errors if applied using infix notation)
> >
> > Compiling in VC++ 6.0
>
> Doesn't show up in VC7 or GCC. Google told me to use
> WX_DEFINE_ARRAY_PTR() instead of WX_DEFINE_ARRAY(). Can't test it
> though. (Google also says the warning is harmless, but if
> there is a way
> to make it go away it should be done)
>
>
> Unix build system patch unchanged and thus not included.
>
> //Magnus
>

Re: Patch: Query favourites

From
Andreas Pflug
Date:
Dave Page wrote:
> Patch applied with the following changes:
>
> - Moved all deps to $PGASRC/../pgadmin3-deps/ on Windows.
> - Replaced the wxTreeCtrl with a ctlTree (which draws lines properly on
> GTK), and added the appropriate XRC resource handlers.
>
> There is a slightly odd effect with the text box on dlgAddFavourite and
> the wxTextEntry dialogue on Windows in which the cursor keeps returning
> to immediately before char 4 (even if the textbox is actually empty),
> but it does actually work as expected.
>
> Andreas; can you look at that please? I'm somewhat baffled...

I'm currently rebuilding my win32 workstation, using VC2005, and
struggling to find windows.h...
I can see the issue with the latest snapshots I compiled, I'd guess some
flags of that textbox are strange.


A word about gtk build:
After installing libxml-dev on my debian box, I had to add a link to
/usr/include/libxml2/libxml as /usr/include/libxml. I wonder if this is
expected. In addition, I needed to add -lxml2 in src/Makefile.

Regards,
Andreas

Re: Patch: Query favourites

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 13 February 2006 14:32
> To: Dave Page
> Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Patch: Query favourites
>
> Dave Page wrote:
> > Patch applied with the following changes:
> >
> > - Moved all deps to $PGASRC/../pgadmin3-deps/ on Windows.
> > - Replaced the wxTreeCtrl with a ctlTree (which draws lines
> properly on
> > GTK), and added the appropriate XRC resource handlers.
> >
> > There is a slightly odd effect with the text box on
> dlgAddFavourite and
> > the wxTextEntry dialogue on Windows in which the cursor
> keeps returning
> > to immediately before char 4 (even if the textbox is
> actually empty),
> > but it does actually work as expected.
> >
> > Andreas; can you look at that please? I'm somewhat baffled...
>
> I'm currently rebuilding my win32 workstation, using VC2005, and
> struggling to find windows.h...

:-( I always use VC++ 6.0 to avoid the extra deps that 2K3+ introduce.

> I can see the issue with the latest snapshots I compiled, I'd
> guess some
> flags of that textbox are strange.

I dunno about the wxTextEntry one, but the one on dlgAddFavourite is
perfectly normal unless I overlooked something.

>
> A word about gtk build:
> After installing libxml-dev on my debian box, I had to add a link to
> /usr/include/libxml2/libxml as /usr/include/libxml. I wonder
> if this is
> expected. In addition, I needed to add -lxml2 in src/Makefile.

Perhaps the acinclude.m4 code should be expanded to look there as well,
and possibly include a --with-xml= option.

Regards, Dave.