Searching PowerBuilder

It is amazing to me that as of version 10.5, Sybase still hasn’t added the ability to search for an object within your application’s libraries. My application has 69 libraries and over 2200 objects, so a manual search is really painful. I’ve brought this issue up with my very expensive support agents, and the answer has always been, ‘There are third-party apps to do that.’

I got so frustrated I even went looking for some of these apps. The best I could find was TechoKitten’s PBL Peeper. It did what I needed, but required more steps than I wanted to take to use on a regular basis. PBSearch looks promising, but provides more functionality than I need. Plus, it’s not free.

So, even though I shouldn’t have to, as much as it galled me that Sybase won’t provide this most basic IDE functionality, I made my own routine to write out the contents of the libraries.

public function of_listLibraries (string as_filepath)

You pass in the path to the file to which you want the library contents written. That’s it.

I call this in the open event of my application. I can’t see that it adds any time at all to the startup. It’s very fast.

Example call:

if of_inIDE() then
    n_cst_pb lnv_pb

    lnv_pb.of_listLibraries( 'E:\cygwin\home\david\pbappcontents.txt' )
end if

The output looks like:

someLibrary.pbl: n_cst_someobject
someLibrary.pbl: n_cst_anotherobject

anotherLibrary.pbl: n_cst_joesobject
anotherLibrary.pbl: n_cst_fredsobject
anotherLibrary.pbl: n_cst_billsobject

This is very efficiently searched using grep. I write my output to the home directory of my cygwin installation. This way I have the library contents and the grep tool in the same place. There are versions of grep for Windows if you don’t want all the unix utilities and functionality cygwin offers.

Here’s the shell shortcut I use for my application search (as):

as: aliased to cat ~/pbappcontents.txt | grep -i $*

Then, at the shell prompt (in cygwin), I can do:

> as name

nfcdwsrv.pbl: n_cst_dwsrv_fullname
nfcstub.pbl: nfc_n_cst_name
nfcstub.pbl: str_name
client_d.pbl: pl_ll_names_syb2ora
client_d.pbl: pl_ll_names_ora2syb

and get back the locations of all the objects containing the word ‘name.’ Very simple.

The only thing cooler would be Sybase building this search capability directly into the IDE. Or allowing us to add it via a customization interface.

Source Code
listlibraries.txt

Advertisements
Published in: on November 19, 2007 at 9:21 pm  Comments (3)