The create object statement populates the database by creating objects and as instance(s) of a given type and all its supertypes.
The new objects are assigned initial values for specified attributes (properties).
create Person(name, income, age) instances
The attributes can be any updatable OSQL function having the created type as its only argument, here
age(). One object will be created for each initializer. Each initializer includes a comma-separated list of initial values for the specified attribute functions. Initial values are specified as expressions.
create Person (name,income) instances
("Kalle "+"Persson" , 3345*1.5)
The types of the initial values must match the declared result types of the corresponding functions.
Each initializer can have an optional variable name which will be bound to the new object. The variable name can subsequently be used as a reference to the object.
create Person(name, income) instances
Then the query
Notice that session variables such as
:pelle are temporary and not saved in the database.
Bag valued functions are initialized using the syntax
create Person (name,parents,income,age)
instances :adam ("Adam",null,2300,64),
It is possible to specify
null for a value when no initialization is desired for the corresponding function.
Objects are deleted from the database with the
The system will automatically remove the deleted object from all stored functions where it is referenced. Deleted objects are printed as:
#[OID nnn *DELETED*]
The objects may be undeleted by
rollback. The automatic garbage collector physically removes an OID from the database only if its creation has been rolled back or its deletion committed and it is not referenced from some variable or external system.