ODBiC Discussion Board


RE: sorry for the dbl post... and a new version? Any preview of what you will add to the new version? (No msg), Dave, 10-20-2004

Yes, a new version soon

by Roger Harris, October 31, 2004 00:49

There aren't really a lot of changes in the new version. This version will be called ODBscript 3.0.

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 $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 tow 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, 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 you 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 input values.

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 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, but depending on when you downloaded, there may be additional features that you don't have in your current version.


Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 


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