4.30. flag

Controls Interchange flags. For example, flags affect database access and transactions for those databases able to support these features. See also the [tag] tag.

4.30.1. Summary

    [flag type]
Parameters Description Default
build Forces build of static Interchange page specified by the name attribute DEFAULT_VALUE
checkhtml   DEFAULT_VALUE
commit Attempts to commit transactions DEFAULT_VALUE
flag Alias for type DEFAULT_VALUE
name Alias for type DEFAULT_VALUE
read Flags the table read-only DEFAULT_VALUE
rollback Attempts to rollback transactions DEFAULT_VALUE
show Normally, the [flag] tag returns nothing to the page. Setting 'show=1' causes the tag to return status, if any. DEFAULT_VALUE
table Alias for tables DEFAULT_VALUE
tables The name of the table to flag
  • 'table' is an alias
DEFAULT_VALUE
transactions Reopens the database in transactions mode if Safe.pm is not active (e.g., in a global subroutine, usertag or [perl global=1] tag). The limitation exists because it is not possible to reopen a database within Safe.pm. DEFAULT_VALUE
type   DEFAULT_VALUE
value The boolean value of the flag DEFAULT_VALUE
write Flags the table writable by default (or read-only if you also set the value=0 attribute) DEFAULT_VALUE
Attributes Default
interpolate (reparse) No
Other_Characteristics  
Invalidates cache YES
Container tag No
Has Subtags No
Nests Yes

Tag expansion example:

    [flag type]
---
    TODO: (tag result)

ASP-like Perl call:

   $Tag->flag(  { type => VALUE_type
}, $body  );

or similarly with positional parameters,

    $Tag->flag(type, $attribute_hash_reference, $body);

4.30.2. Description

The flag tag controls database access and transactions.

If a DBM-based database is to be modified, it must be flagged writable on the page calling the write tag.

For example, you can call

    [flag type=write value=1 table=products]

to mark the products DBM database writable. This must be done before ANY access to that table.

Note that SQL databases are always writable if allowed by the SQL database itself, and in-memory databases will never be written.

Using [flag build] forces static build of a page, even if it contains dynamic elements.

4.30.2.1. build

Forces build of static Interchange page specified by the name attribute

4.30.2.2. checkhtml

4.30.2.3. commit

Attempts to commit transactions

4.30.2.4. read

Flags the table read-only

4.30.2.5. rollback

Attempts to rollback transactions

4.30.2.6. show

Normally, the [flag] tag returns nothing to the page. Setting 'show=1' causes the tag to return status, if any.

4.30.2.7. tables

The name of the table to flag

4.30.2.8. transactions

Reopens the database in transactions mode if Safe.pm is not active (e.g., in a global subroutine, usertag or [perl global=1] tag). The limitation exists because it is not possible to reopen a database within Safe.pm.

4.30.2.9. type

4.30.2.10. value

The boolean value of the flag

4.30.2.11. write

Flags the table writable by default (or read-only if you also set the value=0 attribute)