Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 16, 2016
0 parents commit e0565e2
Show file tree
Hide file tree
Showing 39 changed files with 17,308 additions and 0 deletions.
Binary file added 9781430231479.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Chapter 12/Grzzlies_Schedule.csv
@@ -0,0 +1 @@
Event,Date,Time,Field,Against,Grizzlies,OpponentPractice,11-May-10,18:45,Bottomlands,,,Practice,18-May-10,19:00,Bottomlands,,,Practice,22-May-10,10:00,Forrest Lawn,,,Game,26-May-10,20:15,Airdrie,Airdrie,2,1Game,2-Jun-10,20:15,Tom Brooks,Chinooks,2,3Practice,4-Jun-10,21:00,Bottomlands,,,Game,8-Jun-10,19:00,Bottomlands,Blizzard,4,1Game,13-Jun-10,13:00,Foothills,Callies,,Practice,16-Jun-10,18:45,Bottomlands,,,Game,30-Jun-10,19:15,Bottomlands,Darts,,Game,7-Jul-10,18:45,Glenmore,Vipers,,Game,18-Jul-10,15:30,Mount Royal,Darts,,Game,30-Jul-10,19:00,Bottomlands,Wolves,,Practice,1-Aug-10,11:00,Bottomlands,,,Game,9-Aug-10,20:00,Oakridge,ASP,,Game,20-Aug-10,21:00,Tom Brooks,StormPractice,23-Aug-10,19:15,Bottomlands,Game,25-Aug-10,19:15,Bottomlands,Tigers
Expand Down
46 changes: 46 additions & 0 deletions Chapter 12/database_objects.sql
@@ -0,0 +1,46 @@
-- Create Users Table
CREATE TABLE tusers
(
user_id NUMBER (5, 0) PRIMARY KEY,
user_name VARCHAR2 (10) NOT NULL UNIQUE,
password VARCHAR2 (10) NOT NULL,
active_flag VARCHAR2 (1) NOT NULL
);

-- Create sequence for IDs
CREATE SEQUENCE sn_users;

-- Create Users
-- Note: You should not store passwords in clear text.
-- This was done for demonstration purposes.
INSERT INTO tusers ( user_id, user_name, password, active_flag)
VALUES (sn_users.NEXTVAL, 'martin', 'martin', 'Y');

INSERT INTO tusers ( user_id, user_name, password, active_flag)
VALUES (sn_users.NEXTVAL, 'chris', 'chris', 'Y');

INSERT INTO tusers ( user_id, user_name, password, active_flag)
VALUES (sn_users.NEXTVAL, 'cameron', 'cameron', 'Y');

-- Authentication Function
CREATE OR REPLACE FUNCTION f_login (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN BOOLEAN
AS
v_count PLS_INTEGER;
BEGIN
SELECT COUNT (user_id)
INTO v_count
FROM tusers
WHERE LOWER (user_name) = LOWER (p_username)
AND password = password
AND active_flag = 'Y';

IF v_count = 1 THEN
RETURN TRUE;
END IF;

RETURN FALSE;
END f_login;
/

COMMIT;
Binary file added Chapter 12/martin.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e0565e2

Please sign in to comment.