Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox OCX Internet/Intranet Articles  |  Non-OCX Internet/Intranet Articles  


Paradox as a Web Server
It really can work
by Tony McGuire



OnPostRequest() is where all the action actually starts. This is where you tell the Websrv.ocx what to do when a request for action comes from the Internet, and the type of action requested is POST. (You may also use GET, in which case you could use the OnGetRequest() method on the OCX. For simplicity, I use only POST actions in my websites.)

In the OnPostRequest() above note that the last part of the long call is to handlerequest(). This is how the OCX talks to the Paradox library. Simple concept when you look at it in pieces, but a little convoluted to work out the first time.

OnPostRequest() is the most critical method in the form containing the OCX (onGetRequest() also, if you choose to use it). What OnPostRequest() does is determine what the OCX should do when it a "post" request is received from the Internet. (Accessed from the "Events" tab)

Basically, openlibrary() says "if the library containing the function the Internet user wants to use isn't open, then open that library and cache the functions within it". This way, Paradox doesn't have to continually go to disk to execute your commands - everything is in memory. (pretty standard stuff, but..........)

If you parse out the language here, note that it uses fields in a table ("tcserver" tcursor connected to "server.db" in the open method) to determine which library a method is in and goes to that library and passes the name of the function for handlerequest() to activate. REQ_POST (2), FID_SVR_LIBRARY (3), and FID_SVR_HANDLER (4) are constants declared in the form's "const" section; they describe the field positions in the "server.db" table. REQ_POST, in this instance, is 2 (field 2). request.URI is the function on the Internet form that is requesting action. So, the above says "if you find the request (URI) in field 2, activate the function (method) named in field 4 of the same record within the library named in field 3 of the same record.

Understanding this is the most critical item to comprehending the workings of the whole spaghetti mess. If you don't understand this, you can still use Paradox on the Internet, but you won't be able to expand things very far. Nor will you have much flexibility in your design. (Programmatic design; you can make your site look any way you want.)

Note: I use only Post requests in my code. Then, I only have to program for one type of request, and the OCX/Paradox only coordinate when there is a Post operation. This is a personal preference item.

Step-by-step breakdown of "if (OpenLibrary(..." statement above

OpenLibrary() is a routine that checks to see if the library referenced in OnPostRequest() has been opened. If not, it opens & caches the library (on-the-fly, as part of the OnPostRequest() method).

Step-by-step breakdown of "if (OpenLibrary(..." statement above


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.