diff options
Diffstat (limited to 'lib/mnesia')
-rw-r--r-- | lib/mnesia/doc/src/company.erl | 45 | ||||
-rw-r--r-- | lib/mnesia/doc/src/company_o.erl | 20 |
2 files changed, 38 insertions, 27 deletions
diff --git a/lib/mnesia/doc/src/company.erl b/lib/mnesia/doc/src/company.erl index 28c32ed513..eef5535ed3 100644 --- a/lib/mnesia/doc/src/company.erl +++ b/lib/mnesia/doc/src/company.erl @@ -1,19 +1,20 @@ -%% ``The contents of this file are subject to the Erlang Public License, +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. -%% +%% retrieved online at http://www.erlang.org/. +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% -%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. -%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -%% AB. All Rights Reserved.'' -%% -%% $Id$ +%% +%% %CopyrightEnd% %% -module(company). @@ -83,16 +84,24 @@ g() -> l. %3 female_bosses() -> - Q = qlc:q( [{E#employee.name, Boss#employee.name} || - E <- mnesia:table(employee), - Boss <- mnesia:table(employee), - Atdep <- mnesia:table(at_dep), - Mgr <- mnesia:table(manager), - E#employee.sex == female, - Atdep#at_dep.emp == E#employee.emp_no, - Mgr#manager.emp == Boss#employee.emp_no, - Atdep#at_dep.dept_id == Mgr#manager.dept] + H1 = qlc:q( [{Atdep#at_dep.dept_id,E} || + E <- mnesia:table(employee), + E#employee.sex == female, + Atdep <- mnesia:table(at_dep), + Atdep#at_dep.emp == E#employee.emp_no] + ), + + H2 = qlc:q( [{Mgr#manager.emp,E} || + {AtdepDeptId, E} <- H1, + Mgr <- mnesia:table(manager), + AtdepDeptId == Mgr#manager.dept] ), + + Q = qlc:q( [{E#employee.name, Boss#employee.name} || + {MgrEmp,E} <- H2, + Boss <- mnesia:table(employee), + MgrEmp == Boss#employee.emp_no] + ), mnesia:transaction(fun() -> qlc:e(Q) end). %3 diff --git a/lib/mnesia/doc/src/company_o.erl b/lib/mnesia/doc/src/company_o.erl index 3c7ad0d5e5..dffe9840bb 100644 --- a/lib/mnesia/doc/src/company_o.erl +++ b/lib/mnesia/doc/src/company_o.erl @@ -1,20 +1,22 @@ -%% ``The contents of this file are subject to the Erlang Public License, +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. -%% +%% retrieved online at http://www.erlang.org/. +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% -%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. -%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -%% AB. All Rights Reserved.'' -%% -%% $Id$ %% +%% %CopyrightEnd% +%% + -module(company_o). -compile(export_all). |