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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

SQL Macros in QueryTool.



Hello,
I've been asked to add little macro capabilities to PgAdmin's QueryTool.

My plans:

Every macro has:
- key shortcut (key),
- short descriptive title (title),
- query text (query).

Just right of Favourites menu, I'll add
Macros menu with
- Macros Setup dialog,
- Separator
for macro in macros:
    macro.title + "\t" + macro.key

Macros will be stored, and added to menu just like Favourites. wxMenu description key handler will generate command event, on key shortcut hit.

In frmQuery class I'll add next EVT_MENU_RANGE to event table.
I'll create method which:
1. retrieve query from queryMacroList (think of queryFavoritesFolder without support for sublevels), based on event.GetId(). 2. replace $SELECTED$ placeholder with current selection (if there is placeholder in query, and there is selection in editor)
3. run query (mimic OnExecute behaviour).

I'll start with implementing actual macro capabilities without configuration dialog (tester will edit xml file to add new macros). This part will be ready in two weeks time (I'm coding that in spare time).

Then I'll create configuration dialog. I've got some doubts how to implement so expect question on the list.

If that will work, I think of defining different macro sets for different server/databases (default macros for application, but they can be overridden by macros specific to server or database).

My development platform is:
- Windows Vista Bussines x64, Polish
- VC++ 2005 Express
- wxWidgets 2.8.4 (current stable release)
- PostgreSQL 8.2.4, default package from OpenBSD, run on virtual machine.
I'll start with revision 6393 of PGAdmin code. I'll build 32 bit code (don't know if PGAdmin work in Windows 64 bit environment).

Regards, Krzysiek




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group