Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Documentation by hedongchenchen


									                               User Documentation
                               Snoopy Version 1.50
                              Mike Callahan WFO LMK
                                    August 2009

1.0    Optional Command Line Arguments

Snoopy has two optional command line arguments: 1) database name, and 2) working
directory where files are read or written to. The entire command line looks like this: -d dbname -w workdir

dbname option
This option allows the user to select a different database. If missing, Snoopy uses
get_apps_defaults to obtain the name of the hydrologic database.

workdir option
Snoopy accepts an optional working directory command line argument. If the argument is
present, Snoopy looks for queries in that directory as a subdirectory of appdir, where appdir
is the directory where Snoopy was installed, usually /awips/dev/localapps/snoopy. If no
working directory argument is given, the working directory defaults to appdir/work.

2.0    Using Snoopy

Start Up
Start the program by typing using the command line or by a menu selection for a local
application. At start up the program scans the working directory for all .sql files and lists
them in the Query menu. Next, it looks for a default.sql file and if found, Snoopy executes
the query. The result of the query is displayed in the scrolling window below the query
window. Figure 1 shows an example of the GUI window that initially pops up.

New line characters in string columns can cause problems in WHFS applications. Because
of this, snoopy displays new lines as a tilda (~) to warn the user that a new line is present.

Description of menus

File menu

       Open Query - Display and load files into the query windows with .sql prefix. While
                    the working directory is the default, the user can move to different
       Save Query - Save the contents of the query window into a .sql file.

       Save Data -     Save the contents of the data window into a .csv file.

       Print Query -   Send the contents of the query window to the printer.

       Print Data -    Send the contents of the data window to the system printer in small
                       font, switching to landscape if necessary.

       Exit -          Exit the program.

Query menu

       List of canned queries found in working directory with Default at the top.

The user either clicks on a canned query, or creates a new one and clicks on Go. The
results are displayed in the data window. Any errors will appear in pop-up windows. If a SQL
syntax error occurs, the cursor in the query window will be positioned at the point of the

Queries that contain only SELECT are unrestricted. It is possible that queries which contain
DELETE, UPDATE, INSERT, and DROP are restricted. If so, the first time these commands
are detected in a session where the database name was NOT given, the program asks for
the HydroBase password. If the correct password is typed in, the query is allowed and all
future queries are unrestricted. If incorrect, the query is ignored. The user is given three
chances to enter the correct password in a session. After the third unsuccessful try, all
future restricted queries are rejected. This password feature is turned off by default but can
be turned on by the installer. This feature actually offers little security since a user could
quickly find out the HydroBase password using Snoopy if they knew the correct table to

Help menu

       Query Maker - This creates a blank query template in the query window. The
                     template is SELECT, FROM, WHERE, ORDER BY each on a
                     different line.

       Table Info -    Display the table infomation GUI. A list of all the tables of the
                       database in a scrolling window appears (figure 2). Below the window
                       are five buttons: Explain, Columns, Brief, Full, Type. Explain displays
                       a pop-up window with a short description of the table. Columns
                       displays the column information GUI in another window (figure 3).
                       This new window has Explain and Type buttons for the columns.
                       Brief displays the first 23 rows of the table in the data area, quickly.
                       Full displays all the rows of the table in the data area. Type types in
                     the name of the table or column in the query window. In the table
                     window, the cursor automatically moves to the end of the second line
                     in the query window. This matches the Query Maker template.

      SQL -          Display the contents of sql.hlp in a window (figure 4). This is a file
                     with SQL information. This file can be edited, and if someone comes
                     up with a better file, send it to the author and it will be included in the
                     next release.

      About -        Pop-up a box that lists information about the program.

3.0   Abbreviations and Acronyms

SQL      Structured Query Language

Figure 1. Main Display Window with example default.sql displayed
Figure 2. Table Information GUI   Figure 3. Column Information GUI

Figure 4. SQL Help Screen

To top