ODBiC Discussion Board


RE: Changes Between Versions 2.2 and 3.0, Frank Wagoner, 03-19-2005

by Roger Harris, March 22, 2005 16:09

The 3.0 version has several important bug fixes, but there are also several enhancements:

There are some new file commands -- OPEN, WRITE, and CLOSE -- and a $read( ) string function. This will allow you to have multiple files open at the same time for reading and writing, so they are a little more flexible than than the OUTPUT and IMPORT commands.

The SENDMAIL command now supports authenticated login for SMTP servers that support the LOGIN and PLAIN authentication methods. (Most Windows mail servers support LOGIN, because Outlook uses that, and most UNIX systems support at least PLAIN, unless it has been disabled to require a stronger method such as CRAM-MD5. ODBscript doesn't yet support CRAM-MD5, but I'm working on it.) Also, 3.0 validates the general format of email addresses (because some servers will stop responding if a malformed email address is sent), and it does not stop processing if the server returns any error for any email recipient. (It only returns an error if there are NO valid recipients to send to. This was a change requested so that one bad address in a mailing list would not prevent the mail from being sent to the other recipients.)

The IMPORT function now supports standard CSV format (e.g. you should now be able to read any Excel spread sheet), including allowing line breaks inside of quoted values.

The $format( ) function now supports date formats, which are specified using various combinations of "d", "m" and "y" characters. (Like $dateAdd( ) and $dateDiff( ), this requires that the value to be formatted must be any valid, recognizable date format, including month names or abbreviations, either two or four digits for the year, and any combination of "/", "-", ".", comma or space characters for separators.) For example, the mask "mm/dd/yy" produces two digits each for month, day, and year, while "mm/dd/yyyy" is similar but produces four digits for the year; a single "m" or "d" produces either one or two digits for the month or day, while "mm" or "dd" forces two digits with a leading "0" if necessary; "Mmm" produces a three-character abbreviation for the name of the month with an initial upper-case character, while "MMM" produces a three-character all upper-case abbreviation; and "Mmmm" produces the full name of the month with an initial upper-case character while "MMMM" produces the full month name in all upper-case.

The $format( ) function now has a special option that uses the "@" character: Any "@" characters in the mask will be replaced by the entire value to be formatted. This is primarily useful when used in the <% FORMAT %> command, which sets up a mask that will be used whenever a variable is referenced. For example, suppose that you have a database column named Email that is being displayed in a result table and you want to make it a clickable mailto link. You can do that with format command like this at the top of the script:

<% FORMAT Email="<a href='mailto:@'>@</a>" %>

This type of format mask also allows function calls where the "@" is one of the function arguments. For example, suppose you have a field or database column called Name, containing both first and last name, and you want to insure that whenever it's used, it's displayed with an uppercase initial character for each name and the rest of the characters in lower case. You can do that with a $wcase( ) function in the format mask:

<% FORMAT Name="$wcase(@)" %>

This works for user-defined functions as well, so you can write a function that does any kind or reformatting or translating every time the variable is referenced.

The HTTPGET and HTTPPOST commands will now allow https SSL connections (although that requires installing two additional OpenSSL DLLs). (This feature also adds quite a bit of code to ODBscript itself, so I will probably include an .exe version in the download that doesn't have it. So, if you don't need to get https requests, you can use the smaller version.)

For security purposes, the "no template" mode has been changed to require specially encrypted inputs for the database specification and SQL statement (i.e. the "database" and "sql" input variables). The UPDATEFORM and INSERTFORM will now use that encryption. There are two new functions that you can use for your own "no template" inputs: $sysEncrypt( ) and $sysDecrypt( ). These are similar to $encrypt( ) and $decrypt( ) except that they use a special encryption key that's unique (and secret) for each Web server. (You can also use those functions for other cases where you want to encrypt data that will be passed back in input forms.) This will be one of the few sources of possible incompatibility with the old version: if you have forms that pass in the "database" and "sql" inputs for "no template" mode execution, they will need to be changed to use $sysEncrypt( ) for those values, and the variables need to be renamed to in_database and in_sql.

There are a pair of new functions, $pathTranslated( ) and $pathInfo( ), that make it easier to reference directories relative to the current script without hard-coding paths. For example, $pathTranslated("..\logs\output.txt") produces a path up to the "parent" directory of the script's subdirectory, then down to a subdirectory named logs, without needing to know the name of the parent directory. (The $pathTranslated( ) function works on the absolute file system path of the script, while $pathInfo( ) works on the Web-server-mapped directory as used in URLs.)

There is a function named $htmlcode( ) that outputs the given string as "&#n;" encoded characters (where "n" is the decimal value of the character), which browsers convert back to characters when encountered in HTML text. (One use for this function is to encode "mailto" links so that e-mail address harvesters won't recognize them.) There is also a $base64( ) function which encodes the string as Base 64, which is needed for certain internet protocols.

There are three "bitwise" functions: and( ), or( ), and xor( ), which perform the Boolean operations "and," "or," and "exclusive-or" operations on integer values.

There is a new $MD5( ) function that implements the standard "MD5 digest" (or "hash") function. (For security, some systems store MD5 digests instead of actual passwords, because the MD5 digest is non-reversible, but you can compare the MD5 for the user-entered password to the stored value to validate it.)

There are also a few miscellaneous bug fixes, such as problems with the line numbers in the TRACE statements.

That's about all that's definitely new in 3.0, but depending on when you downloaded an older version, there may be additional features that you don't have in your current version. However, all new commands and functions are documented in the Users Guide.


Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 


Copyright 1997-2003, Roger Harris. All rights reserved.