New Caché 5.1 object features and enhancements:
-
New Option to Index on Computed Fields
-
New Object Synchronization
-
New Studio Extension Classes and Source Control Hooks
-
-
-
-
Performance Improvements for Relationships
-
New Option to Index on Computed Fields
An index definition can now reference properties defined as CALCULATED and SQLCOMPUTED.
The property value calculation must be deterministic, always returning the same value
for a given set of parameters. For example, it would be a mistake to use a function
such as $Horolog, which returns different values depending on when it is called. Indexing
on a property whose computation is nondeterministic will result in an index that is
not properly maintained.
To support this option, properties defined as SQLCOMPUTED are now computed in
Caché Objects. A new class method, Compute, is called by the property's Get
method. The Compute method generates a return value by scanning SQLCOMPUTECODE for
field references and converting those references to property or literal values. If
the property also has SQLCOMPUTEONCHANGE, the Compute method is called whenever the
property is changed.
New Object Synchronization
This new feature enables Caché to synchronize objects between databases.
All object filing events (insert, update and delete) for journaled classes are automatically
tracked. Object synchronization utilities provide methods to export the journaled
object data and synchronize it with other databases. Applications with no access to
the original database can then resolve references to the synchronized objects.
A new class,
%SYNC.SyncSetObject, supplies methods to
externalize an object and apply it to the target database. All references to persistent
objects from the object being externalized are converted to GUID (Globally Unique
Identifier) values. The GUID values are used to look up the corresponding object on
import.
Another class,
%SYNC.SyncSet, implements methods to manage
the set of objects being synchronized. A 'synchronization set' is a set of externalized
object values which guarantee that all object references can be resolved, either because
the referenced object is in the same sync set, or because it already exists in the
target database.
New Studio Extension Classes and Source Control Hooks
This release enhances the flexibility of Caché Studio by introducing
the
%Studio.Extension classes, which provide mechanisms for
custom menus and user defined data entry. The
%Studio.SourceControl classes
now provide enhanced source control hooks, allowing customized checkout and checkin
to a source control system.
When the user performs an action in Studio that may require user interaction
with the server (for example, attempting to edit a document that is in source control
but is not checked out), Studio now calls the
UserAction method.
-
Server defined menu item selected
-
Name is the menu item name if
Type is
a menu item, otherwise
Name indicates one of the following options:
-
User has tried to change a document that is locked in source control
-
User has created a new document
-
User has deleted a document
InternalName is the name of the document this action is concerned
with.
SelectedText contains any selected text in the document that
has focus.
Action returns an action that Studio should perform:
-
Do nothing (this method can still perform some action such as check
an item out of source control, but Studio will not ask for user input).
-
Display the default Studio dialog with a yes/no/cancel button. The
text for this dialog is provided in the
Target return argument.
-
Run a CSP Template.
Target is the start page name
for the template. The template will be passed the current document name, any selected
text, the project name, and the namespace.
-
Run an EXE on the client.
Target is the name of
an executable file on the client machine.
-
Insert the text in
Target in the current document
at the current selection point
-
Studio will open the documents listed in
Target
You can define custom menus for Studio to display. Studio obtains the menus
when it first connects to a namespace by running two queries,
MainMenus and
MenuItems.
MainMenus returns
the list of top level menu names. After this top level menu is selected,
MenuItems is
used to return the list of items on a specific menu.
MainMenus can
be either a regular menu or a context submenu that is added to all the context menus.
The
MenuItems query is passed the current document name and any
selected text in case you wish to vary the menu based on these arguments.
By default, the source control class inherits these queries from
%Studio.Extension.Base,
where they are defined as SQL queries against prebuilt tables. To load data into these
tables, define an XData block called
Menu in your source control
class. When the source control class is compiled, this data is loaded and used automatically.
Queries defined in the source control subclass can be changed or completely customized.
When data is being returned from the
MenuItems query, each menu
name will generate a call to an
OnMenuItem method in the
source control class, where you may disable/enable this menu item. This allows simple
modification of the menus without having to write a custom query.
The class hierarchy for current stream classes has been changed so that
%Stream.Object is
the top class. This change does not alter stream runtime behavior.
The syntax of
POPSPEC has been extended to allow an SQL table
name and an SQL column name to be specified. When they are specified, the
Populate() method
constructs a dynamic query to return the distinct column values from the table. The
requested number of values will then be randomly selected from the distinct column
values and placed in a value set. The property will then be assigned values randomly
from the resulting value set.
Performance Improvements for Relationships
The in-memory performance of relationships has been significantly improved by
using additional in-memory indexes to keep track of oref's and oid of items already
in the relationship. Previously, when a new item was inserted into the relationship
(either using the
Insert method, or indirectly via the
Relate method)
it would scan the entire relationship to avoid inserting a duplicate item. By keeping
an index of the oref's and oid's in the relationship, the cost of checking for duplication
items is kept very low even for large numbers of items.
Partition memory used is lower, speed is significantly faster (94x in the second
insert of 1000 items) and
%Save time is faster. When measured
with a small number of items in the relationship, there was no measurable slowdown
in performance associated with the upkeep of the additional in-memory indexes.
This release contains a new version of the Caché Direct control (
VISM.OCX)
that features enhancements such as security upgrades, support for multithreading,
and improved error handling.