<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Ace::Local - use giface, tace or gifaceclient to open a local connection to an Ace database</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@localhost" /> </head> <body style="background-color: white"> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <!-- <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#methods">METHODS</a></li> <ul> <li><a href="#connect__"><code>connect()</code></a></li> <li><a href="#query__"><code>query()</code></a></li> <li><a href="#read__"><code>read()</code></a></li> <li><a href="#low_read__"><code>low_read()</code></a></li> <li><a href="#status__"><code>status()</code></a></li> <li><a href="#error__"><code>error()</code></a></li> <li><a href="#encore__"><code>encore()</code></a></li> <li><a href="#auto_save__"><code>auto_save()</code></a></li> </ul> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#author">AUTHOR</a></li> </ul> --> </div> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>Ace::Local - use giface, tace or gifaceclient to open a local connection to an Ace database</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> use Ace::Local my $ace = Ace::Local->connect(-path=>'/usr/local/acedb/elegans'); $ace->query('find author Se*'); die "Query unsuccessful" unless $ace->status; $ace->query('show'); while ($ace->encore) { print $ace->read; }</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>This class is provided for low-level access to local (non-networked) Ace databases via the <em>giface</em> program. You will generally not need to access it directly. Use Ace.pm instead.</p> <p>For the sake of completeness, the method can also use the <em>aceclient</em> program for its access. However the Ace::AceDB class is more efficient for this purpose.</p> <p> </p> <hr /> <h1><a name="methods">METHODS</a></h1> <p> </p> <h2><a name="connect__"><code>connect()</code></a></h2> <pre> $accessor = Ace::Local->connect(-path=>$path_to_database);</pre> <p>Connect to the database at the indicated path using <em>giface</em> and return a connection object (an "accessor"). <em>Giface</em> must be on the current search path. Multiple accessors may be open simultaneously.</p> <p>Arguments include:</p> <dl> <dt><strong><a name="path" class="item"><strong>-path</strong></a></strong> <dd> <p>Path to the database (location of the "wspec/" directory).</p> </dd> </li> <dt><strong><a name="program" class="item"><strong>-program</strong></a></strong> <dd> <p>Used to indicate the location of the desired <em>giface</em> or <em>gifaceclient</em> executable. You may also use <em>tace</em> or <em>aceclient</em>, but in that case the <code>asGIF()</code> functionality will nog work. Can be used to override the search path.</p> </dd> </li> <dt><strong><a name="host" class="item"><strong>-host</strong></a></strong> <dd> <p>Used when invoking <em>gifaceclient</em>. Indicates the host to connect to.</p> </dd> </li> <dt><strong><a name="port" class="item"><strong>-port</strong></a></strong> <dd> <p>Used when invoking <em>gifaceclient</em>. Indicates the port to connect to.</p> </dd> </li> <dt><strong><a name="nosync" class="item"><strong>-nosync</strong></a></strong> <dd> <p>Ordinarily Ace::Local synchronizes with the tace/giface prompt, throwing out all warnings and copyright messages. If this is set, Ace::Local will not do so. In this case you must call the <code>low_read()</code> method until it returns undef in order to synchronize.</p> </dd> </li> </dl> <p> </p> <h2><a name="query__"><code>query()</code></a></h2> <pre> $status = $accessor->query('query string');</pre> <p>Send the query string to the server and return a true value if successful. You must then call <code>read()</code> repeatedly in order to fetch the query result.</p> <p> </p> <h2><a name="read__"><code>read()</code></a></h2> <p>Read the result from the last query sent to the server and return it as a string. ACE may return the result in pieces, breaking between whole objects. You may need to read repeatedly in order to fetch the entire result. Canonical example:</p> <pre> $accessor->query("find Sequence D*"); die "Got an error ",$accessor->error() if $accessor->status == STATUS_ERROR; while ($accessor->status == STATUS_PENDING) { $result .= $accessor->read; }</pre> <p> </p> <h2><a name="low_read__"><code>low_read()</code></a></h2> <p>Read whatever data's available, or undef if none. This is only used by the ace.pl replacement for giface/tace.</p> <p> </p> <h2><a name="status__"><code>status()</code></a></h2> <p>Return the status code from the last operation. Status codes are exported by default when you <strong>use</strong> Ace.pm. The status codes you may see are:</p> <pre> STATUS_WAITING The server is waiting for a query. STATUS_PENDING A query has been sent and Ace is waiting for you to read() the result. STATUS_ERROR A communications or syntax error has occurred</pre> <p> </p> <h2><a name="error__"><code>error()</code></a></h2> <p>May return a more detailed error code supplied by Ace. Error checking is not fully implemented.</p> <p> </p> <h2><a name="encore__"><code>encore()</code></a></h2> <p>This method will return true after you have performed one or more <code>read()</code> operations, and indicates that there is more data to read. <strong>encore()</strong> is functionally equivalent to:</p> <pre> $encore = $accessor->status == STATUS_PENDING;</pre> <p>In fact, this is how it's implemented.</p> <p> </p> <h2><a name="auto_save__"><code>auto_save()</code></a></h2> <p>Sets or queries the <em>auto_save</em> variable. If true, the "save" command will be issued automatically before the connection to the database is severed. The default is true.</p> <p>Examples:</p> <pre> $accessor->auto_save(1); $flag = $accessor->auto_save;</pre> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><a href="/AcePerl/docs/./Ace.html">the Ace manpage</a>, <a href="/AcePerl/docs/./Ace/Object.html">the Ace::Object manpage</a>, <a href="/AcePerl/docs/./Ace/Iterator.html">the Ace::Iterator manpage</a>, <a href="/AcePerl/docs/./Ace/Model.html">the Ace::Model manpage</a></p> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Lincoln Stein <<a href="mailto:lstein@w3.org">lstein@w3.org</a>> with extensive help from Jean Thierry-Mieg <<a href="mailto:mieg@kaa.crbm.cnrs-mop.fr">mieg@kaa.crbm.cnrs-mop.fr</a>></p> <p>Copyright (c) 1997-1998, Lincoln D. Stein</p> <p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.</p> </body> </html>