Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs427fa20team22
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
htmoss2
cs427fa20team22
Commits
734f5abb
Commit
734f5abb
authored
4 years ago
by
mjw11
Browse files
Options
Downloads
Patches
Plain Diff
Add getter for if a patient is registered
parent
e9e3b17f
No related branches found
Branches containing commit
No related tags found
1 merge request
!22
Merge UC92 into Master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+38
-0
38 additions, 0 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
with
38 additions
and
0 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+
38
−
0
View file @
734f5abb
...
...
@@ -60,6 +60,44 @@ public class PatientDAO {
this
.
procedureLoader
=
new
ProcedureBeanLoader
(
true
);
}
/**
* Returns if the patient is registered
*
* @param mid The MID of the patient in question.
* @return A boolean representing if the patient is registered
* @throws ITrustException
* @throws DBException
*/
public
boolean
getRegistered
(
long
mid
)
throws
ITrustException
,
DBException
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"SELECT registered FROM patients WHERE MID=?"
);
ps
.
setLong
(
1
,
mid
);
ResultSet
rs
;
rs
=
ps
.
executeQuery
();
if
(
rs
.
next
())
{
Integer
b
=
rs
.
getObject
(
"registered"
)
!=
null
?
rs
.
getInt
(
"registered"
)
:
null
;
if
(
b
==
1
)
{
return
true
;
}
else
if
(
b
==
0
)
{
return
false
;
}
else
{
throw
new
ITrustException
(
"Number is not a boolean"
);
}
}
else
{
rs
.
close
();
ps
.
close
();
throw
new
ITrustException
(
"User does not exist"
);
}
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
);
}
finally
{
DBUtil
.
closeConnection
(
conn
,
ps
);
}
}
/**
* Returns the name for the given MID
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment