On Mon, Jan 17, 2011 at 07:46, Magnus Hagander <mag...@hagander.net> wrote: > On Sun, Jan 16, 2011 at 23:02, Dave Page <dp...@pgadmin.org> wrote: >> On Sun, Jan 16, 2011 at 9:50 PM, Jeremy Palmer <jpal...@linz.govt.nz> wrote: >>> It would be really awesome for DBAs admins to be able to run pgscripts from >>> the command line which have developed in pgadmin. Even better if the >>> programme is distributed with the standard win32 download. >>> >>> Would it be possible to revive it and integrate xtra/pgScript into the >>> pgadmin? >> >> Well it's already in the source tree, and already integrated into the >> pgAdmin GUI. All that is needed is a patch to fix the bitrot. As >> always, patches are welcome. > > Seems the first issue at least comes from patch > 93834d477cd3fb91deacc0946ef845622fd6678d which removed our md5 > support. But there seems to be other issues as well. If you (=Jeremy) > want to look at this, that'd be great - if not, I can probably look at > it, but not right now. > > (btw, we really should look at making it not compile pgscript twice - > once for pgadmin and once for the one in xtra/. But that's something > for another day :D)
Here's a patch that seems to make it work. The issues were: * md5 no longer available - but also not needed, removed. * qtIdent() was not available in commandline mode, but needed. This in turn required db/keywords.c to be linked in. Comments/objections on patch? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
diff --git a/pgadmin/include/utils/misc.h b/pgadmin/include/utils/misc.h index 5e54ac2..80255ae 100644 --- a/pgadmin/include/utils/misc.h +++ b/pgadmin/include/utils/misc.h @@ -129,8 +129,6 @@ void CheckOnScreen(wxWindow *win, wxPoint &pos, wxSize &size, const int w0 = 100 wxString IdAndName(long id, const wxString &name); // Quoting -wxString qtIdent(const wxString &value); // add " if necessary -wxString qtTypeIdent(const wxString &value); // add " if necessary wxString qtDbStringDollar(const wxString &value); wxString qtStrip(const wxString &value); // remove \" @@ -257,5 +255,9 @@ wxString sanitizePath(const wxString &path); wxString commandLineCleanOption(const wxString &option, bool schemaObject = false); #endif // PGSCLI +// Quoting +wxString qtIdent(const wxString &value); // add " if necessary +wxString qtTypeIdent(const wxString &value); // add " if necessary + #endif diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp index 2f75d94..7955cfe 100644 --- a/pgadmin/utils/misc.cpp +++ b/pgadmin/utils/misc.cpp @@ -42,6 +42,10 @@ // App headers #include "frm/frmMain.h" +wxImageList *imageList = 0; + +#endif // PGSCLI + extern "C" { #define YYSTYPE_IS_DECLARED @@ -50,10 +54,6 @@ extern "C" #include "parser/keywords.h" } -wxImageList *imageList = 0; - -#endif // PGSCLI - // we dont have an appropriate wxLongLong method #ifdef __WIN32__ #define atolonglong _atoi64 @@ -332,6 +332,7 @@ void FillKeywords(wxString &str) } } +#endif // PGSCLI static bool needsQuoting(wxString &value, bool forTypes) { @@ -385,7 +386,6 @@ static bool needsQuoting(wxString &value, bool forTypes) return true; } - wxString qtTypeIdent(const wxString &value) { if (value.Length() == 0) @@ -419,6 +419,7 @@ wxString qtIdent(const wxString &value) return result; } +#if !defined(PGSCLI) wxString qtStrip(const wxString &str) { diff --git a/xtra/pgscript/lib/Makefile.am b/xtra/pgscript/lib/Makefile.am index 4d90865..7294b42 100644 --- a/xtra/pgscript/lib/Makefile.am +++ b/xtra/pgscript/lib/Makefile.am @@ -11,7 +11,7 @@ noinst_LIBRARIES = libpgs.a nodist_libpgs_a_SOURCES = $(srcdir)/../../../pgadmin/utils/sysLogger.cpp \ $(srcdir)/../../../pgadmin/utils/misc.cpp \ - $(srcdir)/../../../pgadmin/utils/md5.cpp \ + $(srcdir)/../../../pgadmin/db/keywords.c \ $(srcdir)/../../../pgadmin/pgscript/utilities/pgsUtilities.cpp \ $(srcdir)/../../../pgadmin/pgscript/utilities/pgsThread.cpp \ $(srcdir)/../../../pgadmin/pgscript/utilities/pgsMapm.cpp \
-- Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-support