Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if a database has a stored procedure

Status
Not open for further replies.

GriffMG

Programmer
Mar 4, 2002
6,333
FR
Hi All

I hit a wall today with my web i/f and found the bets resolution was a couple of simple stored procedures in the VFP database.

I've never needed them before (stored procedures), so I have never had to manage them (existence of, version control etc.).

Does anyone know if there are built in features to enable you to get - for example a list of the stored procedures as an array?

Many Thanks

Martin

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
APROCEDURES() - no, just kidding.

Open database your.dbc
COPY PROCEDURES TO some.txt

Then you have the procedures. In full, not just a list.

You can strextract() with begindelimiter "PROCEDURE" and enddelimieter CRLF (Chr(13)+Chr(10)) and that done on nOccurence = 1 To n will give you just the procedure names.

By the way: APPEND PROCEDURES is a way to add new procedures at the end or use it with OVERWRITE option to rewrite all procs.

Bye, Olaf.

 
Oh, and I forgot there is also DISPLAY PROCEDURES and LIST PROCEDURES to get a list of the names only. Still you get an output file, no array. But you can easily read that into an array with ALINES(FILETOSTR(...)). You just need to skip the first informative line "Stored procedures in ..."

Bye, Olaf.
 
And as there are always three solutions at least:
Code:
USE your.dbc 
Locate For ObjectName="StoredProceduresSource"
? Code

Bye, Olaf.
 
Hi Olaf.

I've just about decided on the last approach, as my scanning program
can work that way quite nicely.

Thank you

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Always a pleasure.

And while I was kidding with APROCEDURES() there actually is APROCINFO() to extract constants, function and procedure names - in short: the info the Document View Tool shows, when you edit a prg. Unfortunately it really only takes a file name, not a text, but it would work in conjunction with COPY PROCEDURE or storing the CODE Memo into a file.

Bye, Olaf.
 
Hi Olaf

I've used the third approach, I have the scanner holding a current copy of the text file internally, writing it out each time
it is run - that file has a version number in it. When the scanner opens a DB it checks for a StoredProceduresSource, and compares
the version number and updates with the contents of the text file if needed.

All I have to do is update the text file and version number, redistibute my scanner and bingo - everyone has stored procedures in a few seconds.

Tidy if not quite elegant

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top