User's Manual

Appendix D. PDL Syntax 197
and magazine_article_map.article_id =
article_author_map.article_id
and article_author_map.author_id = authors.author_id
} map {
// here we map the attributes of the objects
// to columns returned by the query.
magazine.name = publications.name;
magazine.issueNumber = magazines.issue_number;
magazine.id = publications.publication_id;
author.authorID = authors.author_id;
author.firstName = authors.first_name;
author.lastName = authors.last_name;
}
}
query MagazineWithMaxID {
BigDecimal magazineID;
do {
select max(magazine_id) as magazine_id from magazines
} map {
magazineID = magazines.magazine_id;
}
}
data operation createMagazine {
do {
insert into magazine_article_map (magazine_id, article_id)
select :magazineID, article_id from articles where not exists
(select 1 from magazine_article_map
where magazine_article_map.article_id = articles.article_id)
}
}
data operation DataOperationWithPLSQLAndArgs {
// the "call" keyword after the "do" indicates that the following
// is actually a piece of PL/SQL. The system then uses a
// java.sql.CallableStatement to execute it instead of only a
// java.sql.PreparedStatement.
do call {
myPLSQLProc(:title)
}
}
data operation DataOperationProcWithInOut {
do call {
DataOperationProcWithInOut(:newID, :copiedID)
} map {
newID : INTEGER;
copiedID : INTEGER;
}
}
query DataOperationWithPLSQLAndArgsAndReturnInPDL {
do call {
:title = DataQueryPLSQLFunction(:articleID)
} map {
title : VARCHAR(700);
articleID : Integer;
}
}
query myDataQuery {