<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.61 [en] (X11; I; Linux 2.2.11 i586) [Netscape]"> </head> <body bgcolor="#FEFEDF"> <h2> PgAccess developer API</h2> <hr> <br>Starting with PgAccess 0.98 I am planning to make available a complete API for the PgAccess developers. I plan to make PgAccess not just an administrative tool, but also a tool for easy build of small applications. <p>That's why PgAccess 0.98 has been internally restructured, every main module of PgAccess has became a namespace (see Tcl namespaces) in order to hide the variables and internal procedures to the user. Also, all the global variables that have been used before were grouped under a single big associative array called <b>PgAcVar</b> (PgAccess variables) so they should not interfere with user defined global variables. <br> <br> <p><b><font size=+1>Global variables available</font></b> <br> <center><table BORDER=0 WIDTH="100%" NOSAVE > <tr NOSAVE> <td ALIGN=LEFT VALIGN=TOP NOSAVE><b>PgAcVar</b></td> <td>The main global associative array that hold together various information needed by PgAccess. User should <b><font color="#FF0000">NOT</font></b> alter it under any circumstances.</td> </tr> <tr NOSAVE> <td VALIGN=TOP NOSAVE><b>CurrentDB</b></td> <td>The handler of the current opened database. Can be used for database operations as selects or command execution.</td> </tr> <tr NOSAVE> <td ALIGN=LEFT VALIGN=TOP NOSAVE><b>Messages</b></td> <td NOSAVE>The associative array that holds the translation for the current language. Loaded from the appropriate language file from lib/languages directory</td> </tr> <tr NOSAVE> <td ALIGN=LEFT VALIGN=TOP NOSAVE><b>PGACCESS_HOME</b></td> <td>Keep the system directory of PgAccess root installation</td> </tr> </table></center> <br> <p><b><font size=+1>Window naming convention</font></b> <p>Every toplevel window defined by PgAccess has the following naming convention. Every window name starts with <tt>.pgaw</tt> (PgAccess window) followed by a colon and a name. <i>Example:</i> <blockquote><tt>.pgaw:User , .pgaw:About , .pgaw:ImportExport</tt></blockquote> <b><font size=+1>Namespaces available</font></b> <p>For every tab from the main database window there is a namespace defined (Tables, Queries, Views, Functions, Sequences, Reports, Forms, Scripts, Users, Schema). Every namespace has by default the following procedures: <ul> <li> <tt>new</tt> , no parameter needed</li> <li> <tt>open</tt> , need a single parameter, the object name</li> <li> <tt>design</tt> , need a single parameter, the object name</li> </ul> You can use these procedures if you want to produce the same efects as clicking on the desired tab and then on the "New", "Open" or "Design" buttons from the main database window. <br><i>Example:</i> <blockquote><tt>Tables::open "customers"</tt> <br><tt>Queries::open "Invoices received"</tt> <br><tt>Forms::open "Add new invoice"</tt></blockquote> The <tt>Tables::open</tt> procedure accepts two optional parameters, filter and order. <br><i>Example:</i> <blockquote><tt>Tables::open "phonebook" "name ~* 'joe'" "age desc"</tt></blockquote> will open a table view window with predefined filter "name ~* 'joe'" and ordered by descending age. <p>There is also a special namespace called Database. Here are some procedures and functions defined for this namespace available to the user: <br> <table BORDER NOSAVE > <tr BGCOLOR="#FFCCFF" NOSAVE> <td NOSAVE><b>Name</b></td> <td NOSAVE><b>Parameters</b></td> <td><b>Type</b></td> <td><b>Returns</b></td> <td NOSAVE><b>Description</b></td> </tr> <tr> <td><b>vacuum</b></td> <td>none</td> <td>procedure</td> <td>nothing</td> <td>vacuums the current database</td> </tr> <tr ALIGN=LEFT VALIGN=TOP NOSAVE> <td><b>getTablesList</b></td> <td>none</td> <td>function</td> <td>list</td> <td NOSAVE>returns the list of tables from the current database</td> </tr> <tr ALIGN=LEFT VALIGN=TOP NOSAVE> <td><b>executeUpdate</b></td> <td>sqlcmd</td> <td>function</td> <td>integer</td> <td NOSAVE>execute the sqlcmd command on the current database returning 1 if no errors ocurred or 0 if the command failed</td> </tr> </table> <p><b><font size=+1>Global functions available</font></b> <br> <table BORDER NOSAVE > <tr BGCOLOR="#99FFCC" NOSAVE> <td><b>Name</b></td> <td><b>Parameters</b></td> <td NOSAVE><b>Description</b></td> </tr> <tr ALIGN=LEFT VALIGN=TOP NOSAVE> <td><b>setCursor</b></td> <td>type</td> <td NOSAVE>Set the cursor for all PgAccess windows, type of cursor can be WAIT or CLOCK or WATCH for the hourglass , anything else (or none) to return to the normal cursor shape</td> </tr> <tr ALIGN=LEFT VALIGN=TOP NOSAVE> <td><b>parameter</b></td> <td>msg</td> <td NOSAVE>Shows a modal input dialog with the msg message, wait for user to enter the data and returns it as a string</td> </tr> <tr> <td><b>showError</b></td> <td>msg</td> <td>Shows a modal dialog window with an error message</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table> </body> </html>