You are here: Nolics.net > Dbclass language
Nolics.net help
ContentsIndexHome
PreviousUpNext
Dbclass language

A sample with several dbclass definitions.

The following sample code shows a sample of several persistent class descriptions. 

 

dbclass SimpleCustomer {
    primary key long ID [AutoGenID=True];
    string Name[40];
    link Salesman;
}


type color = "ColorClass.ColorValueAttribute";

dbclass ComplexCustomer [SchemaVersion=2] {
    primary key long ID[AutoGenID=True];
    schemaVersion int SchemaVersion;
    string Firstname[Length=40];
    unique index LastName_idx: string Lastname[Length=40];
    double Salary[UpdateAccess="boss"];
    int StatusCode;
    index idx_salary_statuscode: Salary,StatusCode;
    modifier string mod;
    color c;
    relation Person [] CustomersEmployees;
}

dbclass Person {
    primary key long ID [AutoGenID=True];
    string FirstName[20];
    string LastName[40];
    link ComplexCustomer;
}
Name 
Description 
A dbclass definition defines the persistent parts of a class. 
The dbsubclass keyword is used for true inheritance. 
The basic Nolics.net persistent fields 
(Almost) every class needs an unique identifier, the primary key. 
Queries are used to fetch data from the database. 
Schemaversion can be used to label a certain schema with a numerical key. 
Used to automatically track the last time of modification. 
The Created control property will record the time when the object has been created. 
Used to automatically track the last modifier. 
Creator control property will record the user who creates an object. The value will be stored to the given field. 
The index keyword may be used to mark an index. 
Relations define arrays of pointers to objects of another class. 
The dbsubclass keyword is used for define view using object level concepts. 
Ask a question
Copyright (c) 2006. All rights reserved.