api.html 5.31 KB
Newer Older
Marc G. Fournier's avatar
Marc G. Fournier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
<!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&nbsp;
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>&nbsp;
<br>&nbsp;
<p><b><font size=+1>Global variables available</font></b>
<br>&nbsp;
<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>&nbsp;
<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&nbsp; procedures:
<ul>
<li>
<tt>new</tt>&nbsp; , 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.&nbsp; Here are some
procedures and functions defined for this namespace available to the user:
<br>&nbsp;
<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>&nbsp;
<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>