1Ace::Local(3) User Contributed Perl Documentation Ace::Local(3)
2
3
4
6 Ace::Local - use giface, tace or gifaceclient to open a local
7 connection to an Ace database
8
10 use Ace::Local
11 my $ace = Ace::Local->connect(-path=>'/usr/local/acedb/elegans');
12 $ace->query('find author Se*');
13 die "Query unsuccessful" unless $ace->status;
14 $ace->query('show');
15 while ($ace->encore) {
16 print $ace->read;
17 }
18
20 This class is provided for low-level access to local (non-networked)
21 Ace databases via the giface program. You will generally not need to
22 access it directly. Use Ace.pm instead.
23
24 For the sake of completeness, the method can also use the aceclient
25 program for its access. However the Ace::AceDB class is more efficient
26 for this purpose.
27
29 connect()
30 $accessor = Ace::Local->connect(-path=>$path_to_database);
31
32 Connect to the database at the indicated path using giface and return a
33 connection object (an "accessor"). Giface must be on the current
34 search path. Multiple accessors may be open simultaneously.
35
36 Arguments include:
37
38 -path
39 Path to the database (location of the "wspec/" directory).
40
41 -program
42 Used to indicate the location of the desired giface or gifaceclient
43 executable. You may also use tace or aceclient, but in that case
44 the asGIF() functionality will nog work. Can be used to override
45 the search path.
46
47 -host
48 Used when invoking gifaceclient. Indicates the host to connect to.
49
50 -port
51 Used when invoking gifaceclient. Indicates the port to connect to.
52
53 -nosync
54 Ordinarily Ace::Local synchronizes with the tace/giface prompt,
55 throwing out all warnings and copyright messages. If this is set,
56 Ace::Local will not do so. In this case you must call the
57 low_read() method until it returns undef in order to synchronize.
58
59 query()
60 $status = $accessor->query('query string');
61
62 Send the query string to the server and return a true value if
63 successful. You must then call read() repeatedly in order to fetch the
64 query result.
65
66 read()
67 Read the result from the last query sent to the server and return it as
68 a string. ACE may return the result in pieces, breaking between whole
69 objects. You may need to read repeatedly in order to fetch the entire
70 result. Canonical example:
71
72 $accessor->query("find Sequence D*");
73 die "Got an error ",$accessor->error() if $accessor->status == STATUS_ERROR;
74 while ($accessor->status == STATUS_PENDING) {
75 $result .= $accessor->read;
76 }
77
78 low_read()
79 Read whatever data's available, or undef if none. This is only used by
80 the ace.pl replacement for giface/tace.
81
82 status()
83 Return the status code from the last operation. Status codes are
84 exported by default when you use Ace.pm. The status codes you may see
85 are:
86
87 STATUS_WAITING The server is waiting for a query.
88 STATUS_PENDING A query has been sent and Ace is waiting for
89 you to read() the result.
90 STATUS_ERROR A communications or syntax error has occurred
91
92 error()
93 May return a more detailed error code supplied by Ace. Error checking
94 is not fully implemented.
95
96 encore()
97 This method will return true after you have performed one or more
98 read() operations, and indicates that there is more data to read.
99 encore() is functionally equivalent to:
100
101 $encore = $accessor->status == STATUS_PENDING;
102
103 In fact, this is how it's implemented.
104
105 auto_save()
106 Sets or queries the auto_save variable. If true, the "save" command
107 will be issued automatically before the connection to the database is
108 severed. The default is true.
109
110 Examples:
111
112 $accessor->auto_save(1);
113 $flag = $accessor->auto_save;
114
116 Ace, Ace::Object, Ace::Iterator, Ace::Model
117
119 Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-
120 Mieg <mieg@kaa.crbm.cnrs-mop.fr>
121
122 Copyright (c) 1997-1998, Lincoln D. Stein
123
124 This library is free software; you can redistribute it and/or modify it
125 under the same terms as Perl itself. See DISCLAIMER.txt for
126 disclaimers of warranty.
127
128
129
130perl v5.36.0 2023-01-19 Ace::Local(3)