next up previous contents
Next: 3.2 Graphical user interface: Up: 3 Generic user interfaces Previous: 3 Generic user interfaces

Text-based user interfaces

The qadd and qedit programs give you a textual user interface you are already used to: a text editor such as vi or emacs. You specify your favorite text editor in the EDITOR environment variable.

You use the editor to fill in attribute values in a file that Qddb prepares for you containing either the skeleton of a new tuple or the current value of an existing tuple.

The contents of an attribute may be any Ascii characters, but double quotes and newlines must be preceded by a backslash. Null characters (Ascii 0) are invalid and will produce unspecified results. The text-based user interfaces do not check attribute types such as date or integer; any Ascii value is accepted. You can enter integers by just typing them in. Dates need to be converted to integers, and are most likely not appropriate to enter with these tools.

The text-based user interfaces allow you to expand attributes that are not marked expandable in the Schema. The resulting tuples may not be readable by more careful user interfaces such as nxqddb.

qadd RelationName lets you add new tuples into the given relation. When you invoke qadd, you are placed in your editor editing a temporary file that contains the readable form of an empty tuple. Here is the readable form of an empty tuple for the Schema in Chapter 2.

            $NUMBER$ = "1";
            Book (
                ISBN = ""
                Title = ""
                Authors = ""
                Subject = ""
                Keywords = ""
                Publisher = ""
                Series = ""
                Year = ""
                Edition = ""
                Printing = ""
            Borrower (
                Name = ""
                Address (
                    Street = ""
                    City = ""
                    State = ""
                    Zip = ""
                Phones (
                    Desc = ""
                    Number (
                       Area = ""
                       Prefix = ""
                       Suffix = ""
                Borrowed = ""
                Returned = ""

You may replicate any expandable attribute or subattribute. For example, the Borrowers.Address attribute (that is, the Address subattribute of the Borrowers attribute) might have two instances:

            Borrowers (
                Name = "Henry Coulett"
                Address (
                    Street = "123 Hibersham Way"
                    City = "Leslietown"
                    State = "KY"
                    Zip = "40511"
                Address (
                    Street = "966 Licking Creek Drive"
                    City = "Prestonsburg"
                    State = "KY"

Any attribute or subattribute may be omitted; in the example above, the second address for this borrower is missing a zip code. Qddb understands omitted attributes to have empty values.

When you exit the editor, qadd checks the file for syntactic correctness and then adds the tuple to the relation. If there is a problem, qadd identifies the line in the file that seems wrong and lets you re-edit the same file.

Qedit lets you perform simple queries and invoke the editor on each matching tuple in turn. Qedit may also be invoked to just list the matching tuples in readable format. To invoke the editor on each tuple in the Library relation that has both henry (case is ignored) and coulett:

    $ qedit e Library henry coulett
Once the editor is called, you may modify the tuple in any way you like, subject to the constraints in the Schema.

To view all the matching tuples in readable form:

    $ qedit l MyRelation henry coulett
Qedit allows only very simple queries on words, word ranges, numbers, numeric ranges, and regular expressions. The man pages give full details.

next up previous contents
Next: 3.2 Graphical user interface: Up: 3 Generic user interfaces Previous: 3 Generic user interfaces

Herrin Software Development, Inc.