Database Reference
In-Depth Information
email text,
friend_list text[], -- list of buddies
usernames
friends_only boolean not null default false
);
As well as the message table:
CREATE TABLE message (
from_user text not null references
user_info(username),
sent_at timestamp not null default
current_timestamp,
to_user text not null references
user_info(username),
read_at timestamp, -- when was this
retrieved by to_user
msg_body text not null,
delivery_status text not null default
'outgoing' -- ('sent', "failed")
);
As this is still an "all-in-one database" implementation, the database functions cor-
responding to application methods are very simple.
Creating a user:
CREATE or REPLACE FUNCTION new_user(
IN i_username text, IN i_pwdhash text, IN
i_email text,
OUT status int, OUT message text )
AS $$
BEGIN
INSERT INTO user_info( username, pwdhash,
email)
VALUES ( i_username, i_pwdhash,
Search WWH ::




Custom Search