Programmer Guide/Macro Library/BDataSet: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}} - Project Management}}
{{DISPLAYTITLE:{{SUBPAGENAME}} - Project Management}}
:'''File''': BDataSet.STX, linked to library STX.LIB
:'''File''': BDataSet.STX, linked to library STX.LIB
:'''See also''':  
:'''See also''': [[Programmer_Guide/Macro_Library/BXMLDoc|BXMLDoc]], [[Programmer_Guide/Macro_Library/BXMLDoc|BSTXIni]], [[Programmer_Guide/Macro_Library/DataSetCmd|DataSetCmd]]


This class implements the XML Project document. The Project document is the global database available to all {{STx}} applications and scripts and contains all data and links of the current project. The programmer must not create or destroy the project object because these functions are performed by the application startup and cleanup macros.  
This class implements the XML Project document. The Project document is the global database available to all {{STx}} applications and scripts and contains all data and links of the current project. The programmer must not create or destroy the project object because these functions are performed by the application startup and cleanup macros.  
Line 7: Line 7:
At application startup a <code>BDATASET</code> instance is created and linked to the global Project document which is created and managed by the {{STx}} master shell and/or the application Project. The name of this instance is stored in the shell variable <var>BDATASET</var>. This object must be used to access the project document.
At application startup a <code>BDATASET</code> instance is created and linked to the global Project document which is created and managed by the {{STx}} master shell and/or the application Project. The name of this instance is stored in the shell variable <var>BDATASET</var>. This object must be used to access the project document.


: Never ever call the member functions <code>CONSTRUCT</code>, <code>DESTRUCT</code> or <code>CLOSE</code>!
: Because the object <code>$bdataset</code> is managed by the {{STx}} application control functions, user macros (scripts) should never ever call the member functions <code>CONSTRUCT</code>, <code>DESTRUCT</code> or <code>CLOSE</code>!


If the project content is changed by a command (or during a block of commands), or if a longer operation is performed on the project, the <code>[[Programmer_Guide/Macro_Library/BDataSet#Attach|ATTACH]]</code> and <code>[[Programmer_Guide/Macro_Library/BDataSet#Detach|DETACH]]</code> functions should be called:
Before a shell or a script uses or changes the content of project document, the project document should be attached (locked) using the function call <code>$bdataset attach</code> (see: [[Programmer_Guide/Macro_Library/BDataSet#Attach/ATTACH]].
 
$bdataset ATTACH
  // ...project commands...
$bdataset DETACH


No static commands are implemented; a call to the macro <code>BDataSet</code> (e.g. <code>bdataset save</code>) will do nothing, returning an empty string.
No static commands are implemented; a call to the macro <code>BDataSet</code> (e.g. <code>bdataset save</code>) will do nothing, returning an empty string.

Revision as of 10:44, 26 February 2018

File: BDataSet.STX, linked to library STX.LIB
See also: BXMLDoc, BSTXIni, DataSetCmd

This class implements the XML Project document. The Project document is the global database available to all STx applications and scripts and contains all data and links of the current project. The programmer must not create or destroy the project object because these functions are performed by the application startup and cleanup macros.

At application startup a BDATASET instance is created and linked to the global Project document which is created and managed by the STx master shell and/or the application Project. The name of this instance is stored in the shell variable BDATASET. This object must be used to access the project document.

Because the object $bdataset is managed by the STx application control functions, user macros (scripts) should never ever call the member functions CONSTRUCT, DESTRUCT or CLOSE!

Before a shell or a script uses or changes the content of project document, the project document should be attached (locked) using the function call $bdataset attach (see: Programmer_Guide/Macro_Library/BDataSet#Attach/ATTACH.

No static commands are implemented; a call to the macro BDataSet (e.g. bdataset save) will do nothing, returning an empty string.

The class BDataSet is derived from the class BXMLDoc.

Beware of using the base class functions, since they do not update the BDataSet member variables!


Attach/Detach

The function ATTACH locks the project document and returns the internal xml-file item containing the project data. Only the calling shell can now access the project content, all other shells are blocked. The project document remains locked until the next call to DETACH.

Multiple calls of ATTACH (by the same shell) are possible, but for each call of ATTACH also the function DETACHmust be called.

// example for using ATTACH / DETACH
// first attach call - lock project document and save current xml-position (pos1)
#projectFileItem := $bdataset attach
... 
//	second attach call - save xml-position (pos2)
...
// first detach call - restore xml-position pos2
...
//	second detach call - restore xml-position and unlock project document, 
//	if the project document was changed by the code between first attach and second detach,
// the message "DATASETCHANGED" is sent to all running shells

Navigation menu

Personal tools