Home

[Package Index | Mudlib Index | Effect Index]

File /cmds/errors_base.c

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:
  • Id - The unique identifier for a report
  • DirEntryDate - The date the report was entered into the directory (changes when forwarded)
  • EntryDate - The date the report was made in time() format
  • FixDate - The date the report was fixed or marked otherwise in time() format
  • Directory - The directory the report belongs to
  • Filename - The filename of the object the report was made on
  • Category - The category the report belongs to, one of 'ROOM', 'OBJECT', 'RITUAL', 'SPELL', 'HELP', or 'COMMAND'
  • Type - The type of the report, one of 'TYPO', 'BUG' or 'IDEA'
  • Name - The name of the object
  • Reporter - The name of the person who made the report
  • Fixer - The name of the person who fixed the report or otherwise marked it
  • Status - The status of the report, one of 'OPEN', 'FIXING', 'CONSIDERING', 'DENIED', or 'FIXED'
  • Report - The text of the report as typed by the reporter
  • Runtime - The runtime error that may or may not(!) relate to the report
There are is also a separate table for forwards, which has the following fields:
  • Id - The bug report id the forward belongs to
  • ForwardDate - The date the report was forwarder in time() format
  • Forwarder - The name of the person who forwarded the report
  • OldDirectory - The directory the report belonged to before forwarding
Finally, a table for comments exists with the following fields:
  • Id - The bug report id the comment belongs to
  • CommentDate - The date someone made a comment on the report in time() format
  • Commenter - The name of the person who commented on the report
  • Comment - The comment about the report

Written by Turrican

Includes

This class includes the following files /include/db.h, /include/log.h and /include/config.h

Method index

  • comment_bug(mixed, int, string, string)
    This method stores a comment about the report.
  • finish_errors(mixed)
    This method ends access to the database.
  • forward_bug(mixed, int, string)
    This method forwards the bug report to a different directory.
  • get_comments(mixed, int)
    This method gets the comments about a report in the database.
  • get_fields(mixed, string, string, string)
    This method fetches the specified fields from the database.
  • get_forwards(mixed, int)
    This method gets the forwarding info for a report in the database.
  • get_row(mixed, int, int)
    This method returns a row of information from the database.
  • init_errors(mixed, string, int)
    This method initializes some state variables and connects to the errors database.
  • save_changes(mixed, string)
    This method saves any pending changes into the database.
  • set_status(mixed, int, string)
    This method changes the status of a bug report.
  • set_type(mixed, int, string)
    This method changes the type of a bug report.
  • sql_query(mixed, string, mixed * args)
    This method provides direct SQL access to the errors database.

Protected Functions

These are functions that only objects inheriting the class can access.

    comment_bug
    string comment_bug(mixed key,
                       int row,
                       string who,
                       string comment)
    

    This method stores a comment about the report. Unlike most other methods, this is immediately saved in the comments table!
    • Parameters:
      key - the unique key for the global variables
      row - the row number of the bug to forward
      who - the name of the commenter
      comment - the text of the comment
    • Returns:
      0 for succes, an error string for failure
    finish_errors
    string finish_errors(mixed key)
    

    This method ends access to the database. It doesn't save any pending changes.
    • Parameters:
      key - the unique key for the global variables
    • Returns:
      0 for succes, an error string for failure
    • See also:
      init_errors() and save_changes()
        forward_bug
        int forward_bug(mixed key,
                        int row,
                        string directory)
        

        This method forwards the bug report to a different directory.
        • Parameters:
          key - the unique key for the global variables
          row - the row number of the bug to forward
          directory - the name of the new directory
        • Returns:
          1 for succes, 0 for failure
            get_comments
            mixed get_comments(mixed key,
                               int row)
            

            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.
            • Parameters:
              key - the unique key for the global variables
              row - the row number to get the comments for
            • Returns:
              a mapping with the comments or an error string
            • See also:
              get_fields() and get_forwards()
                get_fields
                varargs mixed get_fields(mixed key,
                                         string directory,
                                         string fields,
                                         string type)
                

                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.
                • Parameters:
                  key - the unique key for the global variables
                  directory - the directory to get the reports from
                  fields - a comma separated list of fields you wish to fetch
                • Returns:
                  the number of reports that were found or an error string
                • See also:
                  get_bug(), get_forwards() and get_comments()
                    get_forwards
                    mixed get_forwards(mixed key,
                                       int row)
                    

                    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.
                    • Parameters:
                      key - the unique key for the global variables
                      row - the row number to get the forwards for
                    • Returns:
                      a mapping with the forwards or an error string
                    • See also:
                      get_fields() and get_comments()
                        get_row
                        varargs mixed get_row(mixed key,
                                              int row,
                                              int nomap)
                        

                        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.
                        • Parameters:
                          key - the unique key for the global variables
                          number - the row number of the bug report
                          nomap - set to 1 if the real row number is given
                        • Returns:
                          a row from the database or an error string
                        • See also:
                          get_fields() and efun::copy()
                            init_errors
                            varargs string init_errors(mixed key,
                                                       string user,
                                                       int replace)
                            

                            This method initializes some state variables and connects to the errors database.
                            • Parameters:
                              key - the unique key to use for the global variables
                              user - the username used to connect to the database
                              replace - set to 1 if an existing key should be replaced
                            • Returns:
                              0 for succes, an error string for failure
                            • See also:
                              save_changes() and finish_errors()
                                save_changes
                                string save_changes(mixed key,
                                                    string user)
                                

                                This method saves any pending changes into the database.
                                • Parameters:
                                  key - the unique key for the global variables
                                  user - the name of the person who made the changes
                                • Returns:
                                  0 for succes, an error string for failure
                                • See also:
                                  finish_errors() and init_errors()
                                    set_status
                                    int set_status(mixed key,
                                                   int row,
                                                   string status)
                                    

                                    This method changes the status of a bug report. In the old system it would delete the bug.
                                    • Parameters:
                                      key - the unique key for the global variables
                                      row - the row number to change the status of
                                      status - the new status of the report
                                    • Returns:
                                      1 for succes, 0 for failure
                                        set_type
                                        int set_type(mixed key,
                                                     int row,
                                                     string type)
                                        

                                        This method changes the type of a bug report. Possible types are 'IDEA', 'BUG' and 'TYPO'.
                                        • Parameters:
                                          key - the unique key for the global variables
                                          row - the row number to change the type of
                                          type - the new type of the report
                                        • Returns:
                                          1 for succes, 0 for failure
                                            sql_query
                                            varargs mixed sql_query(mixed key,
                                                                    string query,
                                                                    mixed * args ...)
                                            

                                            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().
                                            • Parameters:
                                              key - the unique key for the global variables
                                              query - the SQL query to execute
                                            • Returns:
                                              the number of rows or an error string
                                            • See also:
                                              get_row() and get_fields()
Valid HTML 4.01 Transitional
Valid CSS!
Read More