Miva Empresa/Mia/Script Compiler v5.00 Release Notes ---------------------------------------------------- New Features ------------ o The new built-in function xml_parse takes three parameters. xml_parse( filepath, location, output var ) filepath - Location of the file to parse. location - either 'script' or 'data'. Anything else will use the default "data". output - xml file parsed into an aggregate. Returns 1 on success, 0 on error. The output variable has this format: The variable has one structure member with the name of the root tag as the member name. This structure (and substructures) contain: NAME Name of the tag VALUE text value of the content data. CHILDREN[n] Children tags [if any] in order in the file TAGS The children tags [if any]; a structure with the tag name as the member name, and the structure has this structure (NAME, CHILDREN[n], etc.) LINENO Line number in the file OFFSET Offset in the file that the start tag starts Character sequences "\n" and "\r" in CDATA sections in xml_parse will be converted to ascii(10) and ascii(13) respectively. o MivaSQL is a new database interface that implements most of the ISO SQL92 standard, and the LEFT OUTER JOIN syntax of ISO SQL99, on top of dBase-compatible datafiles and Miva proprietary format index files. o The MvPACK tag will pack all tables (.dbf files and attendant .mvx files) for a given schema. o MivaSQL MvOPEN and MvCREATE syntax is the same as previous external database files, except that the MvCREATE will create the schema and put the metadata (table and index information) in the file specified by the DATABASE attribute. The FIELDS attribute is still required, but can be left blank (e.g., ) Tables and indexes are created using the "CREATE TABLE" and "CREATE INDEX" SQL command. o Two new functions, fisdir and sisdir, will return a zero or one whether the passed filename is a directory relative to the data or script path, respectively. o The new MvREFERENCE tag will create a reference from one variable to another, such that changes to one will appear to be made to the other. It can be also used to refer to a variable named by an expression, like the miva_variable_value built-in function. Usage: Examples: o The MvTRANSACTION tag will suspend auto-commit settings for a database until a MvCOMMIT or MvROLLBACK tag is executed. Usage: o The MvDBCOMMAND tag is used to issue commands to a database that has already been opened or created via the MvOPEN or MvCREATE tags. Usage: All database interfaces take these commands: Command log Purpose: Log interface-specific details to a log file. Parameter: If specified, the name of the file to log to in the data directory. The ODBC interface additionally takes these commands: Command manualcommit Purpose: Set the database connection to not automatically execute a commit after every statement. Parameter: None autocommit Purpose: Reset the database connection to automatically execute a commit after every statement. Parameter: None truncate Purpose: Truncate text data to the size of the field before inserting. Only necessary if the database does not do this by itself, and errors are not desired. Parameter: None forwardonly Purpose: Disables attempts to scroll backwards in a view using MvSKIP with a negative ROWS parameter or MvGO. Parameter: None The MySQL interface additionally takes these commands: Command manualcommit Purpose: Set the database connection to not automatically execute a commit after every statement. Parameter: None autocommit Purpose: Reset the database connection to automatically execute a commit after every statement. Parameter: None The ORACLE interface additionally takes these commands: Command ? Purpose: Parameter: o The s.miva_config system variable gives read-only access to information in the configuration. It is a structure, with the configuration name being the name of the member. In addition to that, two sub-arrays "database_list" and "commerce_list" contain the the names of the configured database types and commerce library types. o The new api function mvDirectory_Listing returns a directory listing. int mvDirectory_Listing( mvProgram program, int location, const char *path, int path_length, mvVariableList output ) program - the mvProgram context location - MVF_SCRIPT, MVF_DATA, or MVF_COMMERCE path - The path to a directory relative to the location. path_length - Length of the path string. output - mvVariableList that will be populated with mvVariables containing the file name. Returns Count of entries in the "output" mvVariableList. The calling program is responsible for calling mvVariable_Free on the variables inserted into the output mvVariableList. o The new api function mvProgram_ResetGlobalTimeout() will reset global timeout to zero. o Miva Mia will now detect the version of Microsoft Windows used, and use newer file access routines when appropriate. o The new built-in function "dir" takes three parameters: dir( path, location, entries var) path - The path to a directory relative to the location. location - the value "script" or "data". Anything else will use the default "data". entries - array of resultant file names. Returns Count of entries in the "entries" variable. o A new built-in function wdownload takes the first three parameters as wget, and acts the same as wget. It takes in addition a fourth and fifth parameter. If the fourth parameter is not blank, it must be the name of a function defined in the same compiled file as the call to wdownload, which takes three parameters: functionname( size, total, data var ) size - The current number of bytes read. total - The expected size of the completed file. data - The variable passed to wget as it's fifth parameter. Returns 0 to abort the wget, 1 otherwise. If the callback is called, the global timeout will be reset when it returns back to wget. o s.miva_config has two new members, commerce_lookup and database_lookup, which are in themselves structures with the names of commerce libraries and database interfaces that are currently configured. i.e., will display 1 if MivaSQL is configured, 0 otherwise. o The MVC file will be closed after initial read, and only reopened when needed. o MvDBCOMMAND for MivaSQL databases now takes a new command: "subdir_char". The MivaSQL database create tables and indices with this character converted to a directory boundary. The MivaSQL database will also manage the subdirectories that it creates. e.g., the statement "CREATE TABLE S01_MMUI_STORESELECTION" will create a datafile called s01/mmui/storeselection.dbf (and the subdirectories if needed). o env.so now prepends "http_" on environment variables if a MvCONFIG_ variable is not found. o MvCALL takes a new attribute "TIMEOUT". This value is used if it is smaller than the configured MvCONFIG_CALL_TIMEOUT value. o The MvCAPTURE tag will "capture" the output until the end MvCAPTURE tag, and put it into a variable. text, expressions, etc. o file_read( filename, location, output ) filename - the file you want read. location - either "script" or "data". Anything else infers "data". output - variable by reference to contain the file. Reads a file. o miva_lockfile( filename, location ) filename - the name of the lock file you want created. location - either "script" or "data". Anything else infers "data". Creates and locks a lockfile. Similar to the behavior of MvLOCKFILE without the behavior. It also creates the exact filename, rather than appending ".lck" to the filename as MvLOCKFILE does. Use fdelete or sdelete (depending on "location") to delete the lockfile. o Two new functions, "miva_member_exists" and "miva_element_exists" return 0 or 1 depending on whether a given member or array element exists. Examples: o A new operator, ISNULL, will return true or false whether or not a given variable is null. o A new function, miva_template_compile, will compile the contents of a string into a template file. miva_template_compile( sig, source, items, targetfile, error ) sig - Any text. The md5 hash value of this text will be stored in the MVC file. source - The source to compile into a template file. items - array of valid item names. The compiler will return an error if an mvt:item tag has a "name" attribute that is not in this list. target - The name of the file (relative to the script directory) to put the .mvc file. error - If the function returns 0, this will contain error text. Example: Error: A brief description of the template language is at the bottom of this document. Bug Fixes --------- o MvSMTP now properly reports the current hostname rather than the hostname it is trying to connect to. o MvCALL now properly times out at connect time. o Database libraries that are not configured will now give the error "Database type '' is not supported or not configured". o MvCREATE on external database types that aren't configured now will correctly set MvCREATE_Error. ******************************************************************************** Template Language ----------------- The template body can have text, HTML and other tags, and a set of entities and tags specific to the template language. These entities and tags start with "mvt". An entity must be placed either inside a tag attribute value, or outside of a tag. "Open" item tags must be matched with "close" item tags, or be empty tags. Entities -------- Entities start with "&mvt", and have an optional fourth character: o mvta will attribute encode the value before output. o mvte will entity encode the value before output. Examples of using entities: Logout
The special case "global" will output the value of the global variable named after the second colon symbol and the semicolon symbol. Tags ---- Example of using open, close, and empty item tags: The follow tags are valid: mvt:item An item tag calls a component with an optional parameter value. The compoents that are valid for a template program are passed as an array to miva_template_compile. Example: mvt:if mvt:elseif mvt:else These tags enable conditional execution of blocks of code. The "expression" value is the same syntax as a Miva Script conditional, without the curly brackets. Example: Store Code "hhh" Store Code "ttt" Unexpected store code mvt:foreach The foreach tag allows iteration through an array defined in a component. The name specified as iteratorname will be set to each of the values in the array. An arrayname starting with "global:" will iterate through a globally-defined array. Example: &mvt:item:name; mvt:exit Stops display of a given template program. Processing of other templates is not affected. Example: See mvt:if example. mvt:comment This tag denotes a comment. The text between and is not compiled, nor is it output in the resulting .mvc file. Example: This is a comment.