[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /cmds/errors_base.c</h2>
This is the low level error database inheritable.  It handles all such
annoying things as connecting to the server and sending the queries.
There are 2 levels of functions, you can do your own queries or
leave the details to this object.
The errors database contains the following fields in the errors table:
<UL>
<LI>Id - The unique identifier for a report
<LI>DirEntryDate - The date the report was entered into the directory
    (changes when forwarded)
<LI>EntryDate - The date the report was made in time() format
<LI>FixDate - The date the report was fixed or marked otherwise in time()
    format
<LI>Directory - The directory the report belongs to
<LI>Filename - The filename of the object the report was made on
<LI>Category - The category the report belongs to, one of 'ROOM', 'OBJECT',
    'RITUAL', 'SPELL', 'HELP', or 'COMMAND'
<LI>Type - The type of the report, one of 'TYPO', 'BUG' or 'IDEA'
<LI>Name - The name of the object
<LI>Reporter - The name of the person who made the report
<LI>Fixer - The name of the person who fixed the report or otherwise marked
    it
<LI>Status - The status of the report, one of 'OPEN', 'FIXING',
    'CONSIDERING', 'DENIED', or 'FIXED'
<LI>Report - The text of the report as typed by the reporter
<LI>Runtime - The runtime error that may or may not(!) relate to the
    report
</UL>
There are is also a separate table for forwards, which has the following
fields:
<UL>
<LI>Id - The bug report id the forward belongs to
<LI>ForwardDate - The date the report was forwarder in time() format
<LI>Forwarder - The name of the person who forwarded the report
<LI>OldDirectory - The directory the report belonged to before forwarding
</UL>
Finally, a table for comments exists with the following fields:
<UL>
<LI>Id - The bug report id the comment belongs to
<LI>CommentDate - The date someone made a comment on the report in time()
    format
<LI>Commenter - The name of the person who commented on the report
<LI>Comment - The comment about the report
</UL><p>Written by Turrican
<h2>Includes</h2>
This class includes the following files <a href="include.db.h.shtml">/include/db.h</a>, <a href="include.log.h.shtml">/include/log.h</a> and <a href="include.config.h.shtml">/include/config.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#comment_bug">comment_bug</a>(mixed, int, string, string)<br/>
This method stores a comment about the report.
<li><a href="#finish_errors">finish_errors</a>(mixed)<br/>
This method ends access to the database.
<li><a href="#forward_bug">forward_bug</a>(mixed, int, string)<br/>
This method forwards the bug report to a different directory.
<li><a href="#get_comments">get_comments</a>(mixed, int)<br/>
This method gets the comments about a report in the database.
<li><a href="#get_fields">get_fields</a>(mixed, string, string, string)<br/>
This method fetches the specified fields from the database.
<li><a href="#get_forwards">get_forwards</a>(mixed, int)<br/>
This method gets the forwarding info for a report in the database.
<li><a href="#get_row">get_row</a>(mixed, int, int)<br/>
This method returns a row of information from the database.
<li><a href="#init_errors">init_errors</a>(mixed, string, int)<br/>
This method initializes some state variables and connects to the errors
database.
<li><a href="#save_changes">save_changes</a>(mixed, string)<br/>
This method saves any pending changes into the database.
<li><a href="#set_status">set_status</a>(mixed, int, string)<br/>
This method changes the status of a bug report.
<li><a href="#set_type">set_type</a>(mixed, int, string)<br/>
This method changes the type of a bug report.
<li><a href="#sql_query">sql_query</a>(mixed, string, mixed * args)<br/>
This method provides direct SQL access to the errors database.
</ul><h2>Protected Functions</h2>
These are functions that only objects inheriting the class can access.<p>
<ul><a name="comment_bug">
comment_bug</a><pre>
string comment_bug(mixed key,
                   int row,
                   string who,
                   string comment)
</pre></br>
This method stores a comment about the report.
Unlike most other methods, this is immediately saved in the
comments table!
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number of the bug to forward
<br/>who - the name of the commenter
<br/>comment - the text of the comment
<li><b>Returns:</b>
<br/>0 for succes, an error string for failure

</dl>

<ul><a name="finish_errors">
finish_errors</a><pre>
string finish_errors(mixed key)
</pre></br>
This method ends access to the database.  It doesn't save any pending
changes.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<li><b>Returns:</b>
<br/>0 for succes, an error string for failure
<li><b>See also:</b>
<br/><a href="#init_errors">init_errors()</a> and <a href="#save_changes">save_changes()
</a></dl>

<ul><a name="forward_bug">
forward_bug</a><pre>
int forward_bug(mixed key,
                int row,
                string directory)
</pre></br>
This method forwards the bug report to a different directory.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number of the bug to forward
<br/>directory - the name of the new directory
<li><b>Returns:</b>
<br/>1 for succes, 0 for failure

</dl>

<ul><a name="get_comments">
get_comments</a><pre>
mixed get_comments(mixed key,
                   int row)
</pre></br>
This method gets the comments about a report in the database.
The info is given in a mapping indexed by column name where the
values are arrays of the values for the columns, ordered by
CommentDate.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number to get the comments for
<li><b>Returns:</b>
<br/>a mapping with the comments or an error string
<li><b>See also:</b>
<br/><a href="#get_fields">get_fields()</a> and <a href="#get_forwards">get_forwards()
</a></dl>

<ul><a name="get_fields">
get_fields</a><pre>
varargs mixed get_fields(mixed key,
                         string directory,
                         string fields,
                         string type)
</pre></br>
This method fetches the specified fields from the database.  You should
not call this too often as this is a very expensive operation.  Typically
it's called once, at the beginning of your object.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>directory - the directory to get the reports from
<br/>fields - a comma separated list of fields you wish to fetch
<li><b>Returns:</b>
<br/>the number of reports that were found or an error string
<li><b>See also:</b>
<br/><a href="#get_bug">get_bug()</a>, <a href="#get_forwards">get_forwards()</a> and <a href="#get_comments">get_comments()
</a></dl>

<ul><a name="get_forwards">
get_forwards</a><pre>
mixed get_forwards(mixed key,
                   int row)
</pre></br>
This method gets the forwarding info for a report in the database.
The info is given in a mapping indexed by column name where the
values are arrays of the values for the columns, ordered by
ForwardDate.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number to get the forwards for
<li><b>Returns:</b>
<br/>a mapping with the forwards or an error string
<li><b>See also:</b>
<br/><a href="#get_fields">get_fields()</a> and <a href="#get_comments">get_comments()
</a></dl>

<ul><a name="get_row">
get_row</a><pre>
varargs mixed get_row(mixed key,
                      int row,
                      int nomap)
</pre></br>
This method returns a row of information from the database.  Note that
you get the original, not a copy, so any changes you make to the row
will also be reflected in a later get_row().  If you don't want this,
just make a copy(). The row consists of a mapping with the column names
being the keys.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>number - the row number of the bug report
<br/>nomap - set to 1 if the real row number is given
<li><b>Returns:</b>
<br/>a row from the database or an error string
<li><b>See also:</b>
<br/><a href="#get_fields">get_fields()</a> and <a href="#efun::copy">efun::copy()
</a></dl>

<ul><a name="init_errors">
init_errors</a><pre>
varargs string init_errors(mixed key,
                           string user,
                           int replace)
</pre></br>
This method initializes some state variables and connects to the errors
database.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key to use for the global variables
<br/>user - the username used to connect to the database
<br/>replace - set to 1 if an existing key should be replaced
<li><b>Returns:</b>
<br/>0 for succes, an error string for failure
<li><b>See also:</b>
<br/><a href="#save_changes">save_changes()</a> and <a href="#finish_errors">finish_errors()
</a></dl>

<ul><a name="save_changes">
save_changes</a><pre>
string save_changes(mixed key,
                    string user)
</pre></br>
This method saves any pending changes into the database.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>user - the name of the person who made the changes
<li><b>Returns:</b>
<br/>0 for succes, an error string for failure
<li><b>See also:</b>
<br/><a href="#finish_errors">finish_errors()</a> and <a href="#init_errors">init_errors()
</a></dl>

<ul><a name="set_status">
set_status</a><pre>
int set_status(mixed key,
               int row,
               string status)
</pre></br>
This method changes the status of a bug report.  In the old system
it would delete the bug.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number to change the status of
<br/>status - the new status of the report
<li><b>Returns:</b>
<br/>1 for succes, 0 for failure

</dl>

<ul><a name="set_type">
set_type</a><pre>
int set_type(mixed key,
             int row,
             string type)
</pre></br>
This method changes the type of a bug report.
Possible types are 'IDEA', 'BUG' and 'TYPO'.
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>row - the row number to change the type of
<br/>type - the new type of the report
<li><b>Returns:</b>
<br/>1 for succes, 0 for failure

</dl>

<ul><a name="sql_query">
sql_query</a><pre>
varargs mixed sql_query(mixed key,
                        string query,
                        mixed * args ...)
</pre></br>
This method provides direct SQL access to the errors database.  You
have to give a valid SQL query.  It returns the number of rows the
query returned, which can be fetched using get_row().  For a higher
level of access to the database, use get_fields().
<br/><ul>
<li><b>Parameters:</b>
<br/>key - the unique key for the global variables
<br/>query - the SQL query to execute
<li><b>Returns:</b>
<br/>the number of rows or an error string
<li><b>See also:</b>
<br/><a href="#get_row">get_row()</a> and <a href="#get_fields">get_fields()
</a></dl>


[an error occurred while processing this directive]

