We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 30,718 times

Contents

Related Categories

Introducing a post-relational database for .NET - Wrapping Up

JohnSasak

Wrapping Up

To view the inserted objects, execute "SELECT * FROM Employee" for example:

Execute SELECT statement

When you select from the class Employee, the query returns objects from both Employee and Manager since Manager is inheriting from Employee . However, the result table does not include the properties specific to Manager, e.g., Title , because the attribute Title is not visible from the class Employee .

You can define SQL methods for classes. The syntax follows SQL PSM (Persistent Stored Module). For example, let us define an instance method Age() that returns the age of an employee:

CREATE METHOD Age()
RETURNS INTEGER
FOR Employee
BEGIN
  RETURN EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM SELF.BirthDate);
END;

Execute the statement in the SQL Query Analyzer window, and then try the next SELECT query:

SELECT * FROM Employee emp WHERE emp.Age() > 40 ;

The Age() method works for both Employee and Manager, of course. You can override the method for Manager, and enjoy the polymorphic behavior just as you do with .NET.

Next Article

In this article, I showed a quick and brief introduction to SQL programming with Matisse, which shows object features like inheritance and relationships. In the following articles, I will show more details for each topic and discuss the technical advantages and disadvantages.

Comments

  • Matisse+CSLA Code Generator

    Posted by Rha7soft on 27 Mar 2004

    [url="http://v4.livegate.net/rha7soft/"]Matisse+CSLA Code Generator[/url] Is a FREE Tool similar to Code Smith that let's you compile and run your own template scripts, debug them in the same applica...