Difference between revisions of "TABLEMETADATAVERSION()"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 9: | Line 9: | ||
==Description== | ==Description== | ||
− | The TABLEMETADATAVERSION() function returns the metadata version for the current table as an integer. A table's metadata version is incremented by 1 each time a change is made to its metadata using [[ALTER TABLE]]. If no metadata has been applied to the table or there is no table open in the current workarea, TABLEMETADATAVERSION() returns 0. | + | The TABLEMETADATAVERSION() function returns the metadata version for the current table as an integer. A table's metadata version is incremented by 1 each time a change is made to its metadata using the [[ALTER TABLE]] command or the [[MetaData Editor]]. If no metadata has been applied to the table or there is no table open in the current workarea, TABLEMETADATAVERSION() returns 0. |
If the optional <cTable> | <nWorkarea> is specified, then the function will return the version from the specified table. | If the optional <cTable> | <nWorkarea> is specified, then the function will return the version from the specified table. |
Revision as of 05:43, 4 April 2017
Contents
Purpose
Function to return a table's metadata version
Syntax
TABLEMETADATAVERSION([<cTable> | <nWorkarea>])
See Also
ACLASS(), ADDPROPERTY(), ALTER TABLE, AMEMBERS(), COLUMNMETADATA(), COMPOBJ(), CREATE TABLE, CREATEOBJECT(), DATABASEMETADATA(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), Lianja MetaData API, LIST CLASSES, LOADOBJECT(), METADATA_DECODE(), METADATA_ENCODE(), METADATA_FINDTYPE(), NEWOBJECT(), OBJECT(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, TABLEMETADATA()
Description
The TABLEMETADATAVERSION() function returns the metadata version for the current table as an integer. A table's metadata version is incremented by 1 each time a change is made to its metadata using the ALTER TABLE command or the MetaData Editor. If no metadata has been applied to the table or there is no table open in the current workarea, TABLEMETADATAVERSION() returns 0.
If the optional <cTable> | <nWorkarea> is specified, then the function will return the version from the specified table.
Argument | Description |
---|---|
<cTable> | A character string reference to one of the following: - alias name of a currently open table - name of a table in the currently open database - database!table, which can be used whether the database is open or not |
<nWorkarea> | An integer workarea reference. |
TABLEMETADATAVERSION() returns 0 if no metadata has been applied to the specified table or the table or workarea reference is not valid.
Example
open database southwind use customers alias cust in 1 // Current table ? tablemetadataversion() select 0 // By workarea ? tablemetadataversion(1) // By alias ? tablemetadataversion("cust") select cust use // Table in current database ? tablemetadataversion("customers") close database // Table in specified database ? tablemetadataversion("southwind!customers") // setupUI.prg // Compare to section.metaDataVersion parameter id local osection = Lianja.getElementByID(id) // check to see if UI section attributes are same version as last time applied // and if so do nothing (improves performance) if osection.metaDataVersion = tableMetaDataVersion() return endif osection.metaDataVersion = tableMetaDataVersion() local omd = metadata_decode(tableMetaData()) // ...