You Too Can Add Enhancements to WDB
[
Go to WDB/Mini SQL Example Pages ]
[
Go to Web/Database Pages ]
[
WDB Documentation ]
[ Original document Check for changes !]
Due to NASA policy, I cannot give away source code that has been
developed on NASA time. However, I CAN tell you how I did it, so if you're
interested, pull up a chair and pick a feature from the list below that
interests you. As I add functionality, the new stuff will appear here.
Keep in mind that some of what I've done is limited to Mini SQL. If
you want to duplicate these changes for other databases, you will probably
have to do more work since Mini SQL handles requests in a serial manner so
there are no problems with 10 users accessing the same data at the same
time. Other databases might require some kind of table/page/record locking
that I don't have to worry about.
These tutorials are not for the casual reader. You'll have to know
something about how WDB works or learn it to apply these changes to the
original WDB code. You can scan the
original WDB Docs if you want.
Note: Bo Frese Rasmussen, the original WDB author, has returned to
working with WDB. He is in the process of incorporating my enhancements
into a version 1.5 release of WDB. Stay tuned. As soon as the new version
is released, you can bet I will have a link to where you can get it.
This is a list of enhancements I've made to WDB. As the tutorial is
written for an enhancement, the list item will turn into a hyperlink. I'm
writing the tutorials in no particular order, so if you want to request
which one gets done next, or if you use one I've posted here,
mail me.
- Functions:
-
Selecting an FDF form and action from HTML SELECT list.
-
Insert
- Added $action = 'insert_form' and 'insert'.
- Added dbi_getnextserialkey() to msql_dbi.pl file.
- Added 'serial_key' table to the database with fields
'table_name' and 'key_value'. This is how I implemented
serial keys in Mini SQL.
- Added dbi_countrows() to msql_dbi.pl file.
-
Update
- Added $action = 'update_query_form', 'update_query',
'update_form', and 'update'.
- Added Update field in msqlfdf program.
-
Delete
- Added $action = 'delete_query_form' and 'delete_query' and 'delete'.
- Added 'Delete' field to msqlfdf program.
- Added password checking for delete function.
- Added dbi_getpassword() to msql_dbi.pl file.
- Added 'security' table to database, with fields 'username'
and 'password'. Note: No password encryption is done yet.
- Allow Updates and Deletes From a Query Results Page
- It makes sense to give a database administrator the ability
to choose to update or delete a record based on a single query,
instead of doing an update_query, then an update, or a
delete_query then a delete. So, I added the capability to do
a query, then click on the MORE, Update, or Delete link.
-
Results Paging
- Displays database results one page at a time.
- Added 'page' $action.
- Uses the ROW_PAGING and PAGING_KEY FDF global attributes
mentioned in a later section.
- Uses code from Steven Brenner's cgi-lib.pl library to encode
all form data and pass it to WDB via the URL for each new
page.
- FDF Field Attributes: each field in a WDB FDF can
have several attributes. Some attributes have values, and others
affect WDB's behavior simply by existing and require no values.
These FDF attributes affect a single field.
- foreign_key
- Tells WDB to find the serial_key field first, then this field
value must match the serial_key field value.
- Used with insert, update, and delete.
- non_null
- Requires a field to have a value.
- Used with insert and update.
- no_insert
- Hides a field during inserts (i.e. serial keys, etc.)
- Used with insert.
- no_update
- Hides a field during updates (i.e. serial keys, etc.)
- Used with update.
- operators
- Gives the user a pulldown menu of operators to use, instead
of requiring them to know how to use WDB operators. (i.e.
> <, =, ~, ==, like, etc)
- Syntax: operators = ~!like,==!=,&lt=!&lt=,&gt=!&gt=,&lt!&lt,&gt!&gt
- picklist
- Presents a readable list to the user while searching the
database using a different value.
- Syntax: picklist = table1%table1_id,table1_name
- selectlist
- Selects a list of values from a database table for the user
to select from.
- Syntax: selectlist = table1%table1_id
- scrolllist
- Selects a list of values from a database table for the user
to select from and puts them in a scrollable list. (Works
the same way as selectlist.)
- Syntax: scrolllist = table1%table1_id,table1_name
- pulldown
- Selects a list of values from a database table for the user
to select from and puts them in a pulldown list.
- Syntax: pulldown = table1%table1_id,table1_name
- radiolist
- Selects a list of values from a database table for the user
to select from and makes them a set of radio buttons.
- Syntax: radiolist = table1%table1_id,table1_name
- serial_key
- Tells WDB to get a value for this field on insert, or this
field contains the master key value to perform updates and
deletes across join conditions.
- Used with insert, update, and delete.
- Controlling WDB Output
- These field attributes are used to make WDB's output a little
more refined in full-screen mode.
- no_label
- Suppresses the printing of a label for a single field.
- no_space
- Suppresses the spaces between columns on output. (Columnar
output in full-screen mode uses the sameline attribute.)
- line_break
- Used to force blank lines between sections of output.
- separator
- Allows you to designate a delimiter between fields displayed
in columnar mode without spaces between them.
- An Output Example
- This will be an example of how to use the above all
together.
-
- FDF Global Attributes: each FDF has a list of
parameters at the top of the file which affect everything in the file
or set values used by WDB but don't affect individual fields.
HEADER attributes specify titles to put at the top of an HTML
page for performing specific functions. (I_ is for insert, U_ for
update, etc.) HTML attributes are extra HTML text to put under the
header, if needed.
- Changed D_HEADER to DEF_HEADER for default header.
- Added I_HEADER, IR_HEADER, I_HTML, IR_HTML - used with insert.
- Added U_HEADER, UQ_HEADER, UR_HEADER - used with update.
- Added U_HTML, UQ_HTML, UR_HTML - used with update.
- Added D_HEADER, DQ_HEADER, DR_HEADER - used with delete.
- Added D_HTML, DQ_HTML, DR_HTML - used with delete.
- Added NO_INSERT - prevents inserts with the current form.
-
TABLE_RESULTS - puts output into an HTML table.
-
DISTINCT_QUERY - makes all queries use 'select distinct'.
- ROW_PAGING - displays a page of results and puts a link at
the bottom of the page to see the next page of results.
- PAGING_KEY - the field to use as the key for ROW_PAGING.
- QUERY_FORM - allows you to use separate forms for the input
and results pages.
- RESULTS_FORM - allows you to use separate forms for the
input and results pages.
- ALLOW_UPDATES - enables updates from the query results form.
- ALLOW_DELETES - enables deletes from the query results form.
- Other Enhancements:
- Large text strings are put into a TEXTAREA, instead of an INPUT
field. This is really only useful during inserts or updates.
- Changed the msql_dbi.pl file so it can use multiple database
cursors at the same time.
- Bug Fixes:
- Fixed msqlfdf to work with MsqlPerl 1.03 (or better).
- Fixed a bug that called dbi_nextrow() one too many times when
displaying output.
- Fixed msql_dbi to work with Perl 5.003.
[
Go Back to Example Pages ]
[
Go Back to Web/Database Pages ]
[
WDB Documentation ]