Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.
|[Home]||[Back to Tip 73]||[Forward to Tip 75]||[Archives]|
Last modified: November 21, 1997
mail to: email@example.com
(This Tip originally appeared on the PowerBuilder and Java Journal web site.)
Dynamo is Watcoms first contribution to the NetImpact family of internet-related products coming from Sybase. It started shipping in October as part of Sybase SQL Anywhere Professional 5.5.
NetImpact Dynamo lets you write database update applications that run on the web server instead of the client or browser side of the internet connection. You code the application as a combination of HTML and Dynamo Script, and you use the SQL Central database administration utility to store all the code in a SQL Anywhere 5.5 database as shown in Figure 1.
When your program runs, the application server portion of NetImpact Dynamo executes the Dynamo scripts to create more HTML code before shipping it all off to the client. This process usually includes database I/O, and when interactive input is received back from the client yet more Dynamo Script code is executed to process the users request.
A major component of NetImpact Dynamo is an application server which attaches to the CGI, ISAPI or NSAPI-compatible web server of your choice. It also comes with a Personal Web Server for testing applications, and includes several major enhancements to SQL Central and the SQL Anywhere database server to support web sites. The servers and development tools only run on Windows 95 or NT but there is no such restriction on deployment: All vestiges of Dynamo Script are removed from your web pages before they leave the server so any operating system and browser can be used on the client.
Unlike embedded SELECTs in PowerScript the Dynamo SELECT on line 23 returns a result set. The formatting tag on line 39 tells the server what to do with each row: The three data tags are placeholders for the three columns, and the code between lines 40 and 44 causes a new HTML table row with three columns to be created for each row in the result set.
The rest of Figure 5 consists of ordinary HTML tags that start the table definition (lines 31 through 37), end the table (line 47) and close the whole document (lines 49 and 50). Figure 6 shows the result in Netscape Navigator.
The whole script in Figure 5 was initially created by the SQL Central wizard shown in Figure 8. The script was modified slightly for publication but almost all the ugly <tags> were filled in by the wizard.
Is this statement just doing something simple or is it generating code in another language?
Or (gasp) is this Dynamo Script generating Dynamo Script to generate...
Each section is shown again in its final form in Figure 10. Where Figure 9 shows the original source code, Figure 10 shows the code as the browser sees it. The next few paragraphs describe each section and what happens to it along the way from Figure 9 to Figure 10 and how it produces the final output in Figures 11 and 12.
Section D contains Dynamo Script that runs on the server to create an HTML tag and one line of text. Figure 10 shows what Section D looks like after the server is finished with it, and the final display is shown in Figure 12.
Section H shows that NetImpact Dynamo can indeed evaluate Dynamo Script created on the fly. Figure 9 shows a string literal containing Math.PI * 2 while Figure 10 shows that eval() has turned it into 6.2831.
All this talk of macro programming might seem out of place in an article entitled Getting Started, especially since the examples seem to be doing a lot of work for little benefit. After all, most applications dont need to calculate pi-times-two at all let alone do it dynamically via eval().
The corresponding Dynamo Script is shown in Figure 14. Yes, theres more Dynamo Script behind the scenes but it was written once and reused. The code in Figure 14 is the only new code required, and it only takes 9 function calls to do it all.
<HTML> <TITLE>Test Field Macros</TITLE> <BODY BGCOLOR="#FFFFFF"> <H3>Test Field Macros</H3> <!--SCRIPT import defineForm.ssc; defineForm ( "testFields", "testFieldsConfirm.ssc" ); defineField ( "First Name", "firstName" ); defineField ( "Last Name", "lastName" ); defineField ( "Address Line 1", "address1" ); defineField ( "Address Line 2", "address2" ); defineField ( "Address Line 3", "address3" ); defineField ( "Zip/Postal Code", "postalCode" ); defineField ( "Phone", "phoneNumber" ); generateForm(); --> </BODY> </HTML>
If you didn't believe that coding HTML forms was boring then Figure 15 should convince you. And remember, this is a simple form, many are much harder. So how was it generated? Figure 16 tells the story: It contains the code called from Figure 14 to produce Figure 15.
Except for all the strange strings and escape characters the code in Figure 16 is fairly straightforward. That's good, because a real form generator should give the programmer more control over design and layout. It should allow for check boxes, radio buttons and other kinds of fields as well as text input, and it should permit different fields to have different kinds of validation checks. And, of course, the world is crying out for the HTML equivalent of PowerBuilder's DropDownDataWindow.
|[Home]||[Back to Tip 73]||[Forward to Tip 75]||[Archives]||
||[mail to: firstname.lastname@example.org]|