1.1 --- a/prototyp/prototyp.sql Mon Sep 01 21:08:55 2014 +0200
1.2 +++ b/prototyp/prototyp.sql Mon Sep 01 21:38:26 2014 +0200
1.3 @@ -100,8 +100,6 @@
1.4
1.5 use User::grent;
1.6
1.7 - my $i = 0;
1.8 -
1.9 setgrent();
1.10 while (my $group = getgrent()) {
1.11 return_next({
1.12 @@ -146,8 +144,6 @@
1.13 use encoding "UTF-8";
1.14 use User::pwent;
1.15
1.16 - my $i = 0;
1.17 -
1.18 setpwent();
1.19 while (my $user = getpwent()) {
1.20 return_next({
1.21 @@ -197,3 +193,42 @@
1.22 ;
1.23 COMMENT ON COLUMN users_groups.initial IS 'whether this group is the „initial login group“ of given user (the primary group)';
1.24
1.25 +
1.26 +-- processes: ----------------------------------------------------------------
1.27 +
1.28 +DROP VIEW IF EXISTS processes;
1.29 +DROP FUNCTION IF EXISTS processes();
1.30 +DROP TYPE IF EXISTS unix_sql_api_processes;
1.31 +
1.32 +CREATE TYPE unix_sql_api_processes AS (
1.33 + id INTEGER,
1.34 + uid INTEGER,
1.35 + owner VARCHAR,
1.36 + command VARCHAR,
1.37 + arguments VARCHAR[],
1.38 + working_dir VARCHAR
1.39 +);
1.40 +
1.41 +CREATE OR REPLACE FUNCTION processes()
1.42 +RETURNS SETOF unix_sql_api_processes STABLE AS $$
1.43 + use strict;
1.44 + use warnings;
1.45 +
1.46 + use encoding "UTF-8";
1.47 +
1.48 + return_next({
1.49 + id => 123,
1.50 + uid => 456,
1.51 + owner => "nikdo",
1.52 + command => "/bin/omg",
1.53 + arguments => ["a", "b"],
1.54 + working_dir => "/tmp"
1.55 + });
1.56 +
1.57 + return undef;
1.58 +$$ LANGUAGE plperlu;
1.59 +
1.60 +CREATE OR REPLACE VIEW processes AS
1.61 + SELECT * FROM processes()
1.62 +;
1.63 +