Websqlbrowse

Websqlbrowse
Web-based SQL Database Browser
websqlbrowse@headricksoftware.com
Copyright (C) 1998, 1999 Headrick Software Development
http://www.headricksoftware.com
Licensing information: http://www.headricksoftware.com/legal/

Readme file version beta-0.70
10/17/99

  1. Version Notes

  2. Installation Instructions

  3. Configuring Websqlbrowse

  4. Support/Customizations

  5. Warranty (or lack thereof)

1. Version Notes

The is a beta release of Websqlbrowse. The program itself is quite functional at this stage however new features are being implemented and most documentation has yet to be written. Before you consider installing this software, please verify that you have the most current version at http://www.headricksoftware.com/websqlbrowse.html. Feel free to email websqlbrowse@headricksoftware.com with any installation or configuration questions. Source code contributions are also welcome at the same address.

New in version 0.70 is a feature written by contributing developer E. Genov that allows a SQL script to be executed from Websqlbrowse and its results used. Note the new configuration options and updated example.

2. Installation Instructions

  1. unpack the source code in a appropriate location, such as a temporary directory.
           mv websqlbrowse-VERSION /tmp
           cd /tmp
           tar -zxvf websqlbrowse-VERSION.tar.gz
           

  2. change to the websqlbrowse-VERSION directory.
           cd websqlbrowse-VERSION
           

  3. edit the Makefile

    1. make sure that the LFLAGS parameter is appropriate for your MySQL installation (if you have libmysqlclient.a in a library directory that is normally linked, you should be ok).

    2. alter the INSTALLDIR flag to install to your CGI-BIN or other CGI enabled directory under your web server.

  4. edit config.h

    1. delete the "#define USE_JAVASCRIPT" line if you don't want to use JavaScript.

    2. change the DATABASE_NAME define to the name of your database.

    3. if you don't need to use a password to connect, delete the DB_USE_PASSWORD line, otherwise alter the DB_USERNAME and DB_PASSWORD defines accordingly.

  5. if your current user does not have permission to write to the INSTALLDIR you defined in the Makefile, su to root (or another user that can write to that directory).

  6. Type 'make' the program will compile and install to the directory you indicated.

3. Configuring Websqlbrowse

To browse a database table with Websqlbrowse you must first create an HTML template that will POST the necessary parameters to the Websqlbrowse CGI. Each parameter may be included as a hidden INPUT tag (i.e. <INPUT TYPE="HIDDEN" NAME="parameter" VALUE="value">). Alternatively, some parameters may be included in a server-side configuration file. This speeds up pages loads by not passing around static data such as table name, color preferences, etc. The format of the server-side file is one entry per line consisting of "parameter = value". Do not word-wrap a single parameter entry to more than one line. Blank lines and lines starting with a hash sign (#) are ignored. Additional information on how to configure Websqlbrowse is available on the website. Each parameter is listed and described below. Required parameters are required in order for Websqlbrowse to function properly. In Websqlbrowse crashes, include the parameter "wsqlb.debug" for more information. The most likely cause of a crash is the omission of a necessary parameter. Future revisions will handle this more gracefully.

Variable Required? Description
wsqlb.paramfile NO This parmeter allows for the inclusion of any and all template variables in a server-side template file. This greatly increases speed of page loads by not including so much redudant data in the transmission. The format of this file is simply "parameter = value", one parameter per line. Blank lines or lines that begin with a hash sign (#) are ignored.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.paramfile" VALUE="/usr/local/wsqlb/db1.wsqlb">
this parameter cannot be placed in a server-side file (it defines the server side file).
wsqlb.debug NO If this parameter is included, the existence of all required parameters will be forced. This slows things down a bit, but could be useful in the program crashes
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.debug" VALUE="TRUE">
or, server-side: wsqlb.debug = TRUE
wsqlb.action YES must be one of the following:
"list" -- list many records in a browse format)
"detail" -- detail information about one record
"edit" -- edit a record
"update" -- update a record after editing
"new" -- generate a blank form for a new record
"insert" -- insert a record after entered in new form
"delete" -- delete a record
In general, start with "list" Lists have buttons to perform the other tasks.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.action" VALUE="list">
this parameter should not be placed in the server-side file.
wsqlb.table YES The name of the database table you are accessing.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.table" VALUE="Contacts">
or, server-side: wsqlb.table = Contacts
wsqlb.title NO An optional <TITLE> tag.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.title" VALUE="My Contacts">
or, server-side: wsqlb.title = My Contacts
wsqlb.prikey YES The primary key for this table.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.prikey" VALUE="ContactID">
or, server-side: wsqlb.prikey = ContactID
wsqlb.defprikey YES Must be either "nextavailable" or "FALSE" if the primary key is an integer (ie RecordID) "nextavailable" will give new records the next available primary key. This is highly recommended.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.defprikey" VALUE="nextavailable">
or, server-side: wsqlb.defprikey = nextavailable
wsqlb.itemid SOMETIMES Specifies the primary key if accessing a specific record (ie edit, detail, etc.)
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.itemid" VALUE="34">
this parameter should not be placed in the server-side file.
wsqlb.font YES The font to use.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.font" VALUE="Helvetica,Arial">
or, server-side: wsqlb.font = Helvetica,Arial
wsqlb.fontsize NO The font size to use.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.fontsize" VALUE="3">
or, server-side: wsqlb.fontsize = 4
wsqlb.bgcolor YES The background color to use.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.bgcolor" VALUE="#FFFFFF">
or, server-side: wsqlb.bgcolor = #FFFFFF
wsqlb.headercolor YES The color to use for the column headers in a list view.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.headercolor" VALUE="#0000FF">
or, server-side: wsqlb.bgcolor = #0000FF
wsqlb.headerbg YES The background color to use in the above mentioned column headers.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.headerbg" VALUE="#000000">
or, server-side: wsqlb.bgcolor = #000000
wsqlb.labelcolor YES The color to use on field labels in new/detail/edit view.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.labelcolor" VALUE="#0000FF">
or, server-side: wsqlb.labelcolor = #0000FF
wsqlb.linkcolor YES The color to use for links (ie list entries).
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.linkcolor" VALUE="#0000FF">
or, server-side: wsqlb.linkcolor = #0000FF
wsqlb.textcolor YES The default text color.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.textcolor" VALUE="#000000">
or, server-side: wsqlb.textcolor = #000000
wsqlb.vinfocolor YES The color for the version information.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.vinfocolor" VALUE="#0000FF">
or, server-side: wsqlb.vinfocolor = #0000FF
wsqlb.rowcolor NO A background color for each cell in the list view.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.rowcolor" VALUE="#AAAAAA">
or, server-side: wsqlb.rowcolor = #AAAAAA
wsqlb.saveimage NO A button image (optional).
wsqlb.editimage NO A button image (optional).
wsqlb.backimage NO A button image (optional).
wsqlb.newimage NO A button image (optional).
wsqlb.deleteimage NO A button image (optional).
wsqlb.enabledelete NO If defined, delete is enabled and delete buttons are presented (By default, delete is turned off).
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.enabledelete" VALUE="TRUE">

or, server-side: wsqlb.enabledelete = TRUE
Note that the value doesn't matter. Don't include this variable set to FALSE to disable delete. To disable record deletion, just don't include the enabledelete variable at all.
wsqlb.enableedit NO Set to FALSE to disable the edit button. This option defaults to TRUE.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.enableedit" VALUE="TRUE">

or, server-side: wsqlb.enableedit = TRUE
wsqlb.enablenew NO Set to FALSE to disable the new button. This option defaults to TRUE.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.enablenew" VALUE="TRUE">

or, server-side: wsqlb.enablenew = TRUE
wsqlb.listfields YES A comma delimited list of all the table fields to display in list view. Put spaces after each comma.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.listfields" VALUE="ContactID, Name, Email, RelationShipID">
or, server-side: wsqlb.listfields = ContactID, Name, Email, RelationShipID
wsqlb.listfields.types YES A comma delimited list of the types of the fields listed in the listfields parameter. Possible types are: {int, string, bool, url, lookup, file, date, qdate}. lookup types require lookup information in the following format: lookup:Table/LookupField/DisplayField. For example, if you have a "Relationship" field in your Contacts table that takes an integer value which corresponds to the RelationShipID field in a "Relations" table, but you want to display the "RelationDescription" field on the browse, you would use something like: lookup:Relations/RelationID/RelationDescription.
example <INPUT TYPE="HIDDEN" NAME="wsqlb.listfields.types" VALUE="int, string, string, lookup:RelationShips/RelationShipID/RelationShipName">
or, server-side: wsqlb.listfields.types = int, string, string, lookup:RelationShips/RelationShipID/RelationShipName
wsqlb.columntitles NO A comma delimited list of text to display for each column in the list view. If unspecified, the field names are used.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.columntitles" VALUE="ID, Name, Email, Relationship Type">

or, server-side: wsqlb.columntitles = ID, Name, Email, Relationship Type
wsqlb.columnalign NO A comma delimited list of the ALIGN type to use for each column in the list view (i.e. LEFT, RIGHT, CENTER). If unspecified, the columns are left-justified (LEFT).
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.columnalign" VALUE="CENTER, LEFT, CENTER, RIGHT">

or, server-side: wsqlb.columnalign = CENTER, LEFT, CENTER, RIGHT
wsqlb.columnwidth NO A comma delimited list of the WIDTH to use for each column in the list view. If unspecified, the WIDTH parameter is not included.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.columnalign" VALUE="10%, 15%, 15%, %60">

or, server-side: wsqlb.columnalign = 10%, 15%, 15%, %60
wsqlb.detailfields YES A comma delimited list of all the fields to be present in the detail/edit/new record views.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.detailfields" VALUE="ContactID, Name, Email, WebURL, Phone, GenderID, RelationShipID, Notes">
or, server-side: wsqlb.detailfields = ContactID, Name, Email, WebURL, Phone, GenderID, RelationShipID, Notes
wsqlb.detailfields.types YES A comma delimited list of all the field types of the fields in the detailfields parameter.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.detailfields.types" VALUE="int, string, string, url, string, lookup:Genders/GenderID/GenderName, lookup:RelationShips/RelationShipID/RelationShipName, file">
or, server-side: wsqlb.detailfields.types = int, string, string, url, string, lookup:Genders/GenderID/GenderName, lookup:RelationShips/RelationShipID/RelationShipName, file
wsqlb.newdefaults YES A comma delimited list of default values for new records. You can use special variables such as "$nothing" and "$today." If you defined the defprikey parameter as "nextavailable", you can also use the "$nextid" value, which will be the next integer valued primary key for this new record. This is useful if you, for instance, have a notes file for each record located somewhere like "/notes/contactX.notes" where X is the primary key for that contact.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.newdefaults" VALUE="$nextid, $nothing, $nothing, NONE, $nothing, 1, 1, /var/lib/httpd/wsqlb/notes/contact$nextid.notes">
or, server-side: wsqlb.newdefaults = $nextid, $nothing, $nothing, NONE, $nothing, 1, 1, /var/lib/httpd/wsqlb/notes/contact$nextid.notes
wsqlb.numlimiters SOMETIMES If the action variable is set as "list", this is an integer value of the number of statements restricting the SELECT query. It may be 0. For each limiter, a "wsqlb.limitfield" and "wsqlb.limitrequire" field is required.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.numlimiters" VALUE="2">
this parameter should not be placed in the server-side file.
wsqlb.limitfieldX SOMETIMES For each restricting statement (as indicated by the numlimiters parameter), you need to specify which field you are dealing with.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.limitfield1" VALUE="RelationShipID">
<INPUT TYPE="HIDDEN" NAME="wsqlb.limitfield2" VALUE="GenderID">
this parameter should not be placed in the server-side file.
wsqlb.limitrequireX SOMETIMES For each restricting statement (as indicated by the numlimiters parameter), you need to specify what restriction you are dealing with. This should be a fragment that uses "=" "<" ">" or other valid SQL syntax. For example, if your wsqlb.limitfield1 is set to "RelationShipID" and you want the RelationShipID field for the results returned to be "1", your wsqlb.limitrequire1 field would be "= 1". Note that there are some special variables you can use in the limitrequire parameter. For example, if you had a date field and you wanted to get records added before today, you would set the respective limitrequire field to "< '$today'".
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.limitrequire1" VALUE="= 1">
<INPUT TYPE="HIDDEN" NAME="wsqlb.limitrequire2" VALUE="= 1">
this parameter should not be placed in the server-side file.
wsqlb.orderby SOMETIMES For a "list" action, specifies by which fields to order the query.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.orderby" VALUE="Name">
or, server-side: wsqlb.orderby = Name
wsqlb.nolinkul NO If this variable is defined and set as "TRUE", a STYLE tag will be included so that links are not underlined. This makes list views more readable.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.nolinkul" VALUE="TRUE">
or, server-side: wsqlb.nolinkul = TRUE

Parameters for additional functionality created by E. Genov:

wsqlb.SQLscript (new) NO This parmeter allows execution of an algorithm, described by SQL statements. Every SQL statement must end with a semicolon (;). Every statement must begin from a new row. Blank lines or lines that begin (in the first position) with a hash sign (#) are ignored.
example: <INPUT TYPE="HIDDEN" NAME="wsqlb.SQLscript" VALUE="/usr/local/wsqlb/script.sql">
Usually this parameter isn't in a server-side file. All SQL statements will be executed before viewing the content of a SQL table. It's necesary to exist 'end_of_line' after the semicolon of the last SQL statement. It's possible to pass argument(s) to SQL statement(s) by the next parameter(s).
wsqlb.SQLargN (new) SOMETIMES For each SQL statement parameter (as indicated by the &1, &2, ..., &9), you need to specify what value have to be passed from the Web browser. If there isn't this parameter the Websqlbrowse will use the value from wsqlb.limitrequireN and its operation will be ignored. NOTE: Only "=", "<", ">", "<=", ">=", "!=", "<>" operations are recognized.
example: title1: <INPUT TYPE="HIDDEN" NAME="wsqlb.SQLarg1">
This parameter(s) should not be placed in the server-side file.
wsqlb.relparamfile (new) NO This parmeter defines the name of 'WSQLB' file, describing the child's table, which rows will be related. Its value will be assigned the parameter wsqlb.paramfile, when the child's table is shown. If there are any wsqlb.SQLargX parameters, they will be passed to the generated child html file.
wsqlb.relparentX (new) SOMETIMES The value of this parameter may include:
  1. The name of the column of the parent's table. The value of the column field of the chosen rows will be the value of the generated parameter wsqlb.limitrequireX with the operation "=", wich will be used when the child's table is shown. The referred column must be shown in the parent's table.
  2. "&N", where N = 1, 2, ... , 9 As a value of the generated wsqlb.limitrequireX parameter will be used the value of wsqlb.SQLargN parameter with the operation "=". Do not put blanks before "&" !
wsqlb.relchildX (new) SOMETIMES As a value of this parameter is using the name of the column of the child's table, which value will be also the value of the generated wsqlb.limitfieldX parameter for showing rows of the child's table.
wsqlb.relnumcolumn (new) SOMETIMES As a value of this parameter is using the number of the pairs of the parameters wsqlb.relparentX and wsqlb.relchildX.
wsqlb.reltitle (new) NO Its value is used as a title of the screen column with buttons "Next". The push of whichever of them will show the corresponding rows from the child table, related with the chosen row of the parent table.

A simple example:

Consider a Contacts database created with the following SQL script:

Let's say we want to maintain this database using Websqlbrowse. We would first create a server side configuration file with the static settings:

Assume the above file is created as /var/lib/httpd/wsqlb/contacts.wsqlb

Assume the above file is created as /var/lib/httpd/wsqlb/ContactQ.wsqlb

Assume the above file is created as /var/lib/httpd/wsqlb/relations.wsqlb

Assume the above file is created as /var/lib/httpd/wsqlb/QR.wsqlb.

The HTML file used to launch Websqlbrowse would be:

4. Support/Customizations

Support and customizations are available. Contact websqlbrowse@headricksoftware.com.

5. Warranty (or lack thereof)

The product is provided "as is," Headrick Software Development makes no warranties, express or implied, including but not limited to warranties of merchantability or fitness for any particular purpose, or that the use of the product will not infringe any third party patents, copyrights, trademarks, or other rights.

Headrick Software Development will not be liable for any direct, indirect, special, or consequential damages associated with the use of the product.

Please see the licensing information for more information (http://www.headricksoftware.com/legal/).


Copyright © 1999 Headrick Software Development
webmaster@headricksoftware.com