Skip to content

Commit

Permalink
issue #106 Identify by school username
Browse files Browse the repository at this point in the history
implemented pattern search
  • Loading branch information
cnmicha committed Mar 10, 2017
1 parent 437009e commit 77dad8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lazarus/DBConnection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ TDBConnection = class
function getStudentsByBirthdate(birthdate: TDate): ArrayOfStudents;

// Returns student object with given ldap username
// parameter: student's ldap username
// parameter: student's ldap username. "%" can be used as a placeholder
// result: student object
function getStudentByLDAPUser(ldap_user: string): TStudent;
function getStudentByLDAPUserPattern(ldap_user: string): TStudent;

// updateInserts student object into database. Either updates an existing one or inserts a new one
// parameter: student object
Expand Down Expand Up @@ -370,13 +370,13 @@ function TDBConnection.getStudentsByBirthdate(birthdate: TDate): ArrayOfStudents
setStudentFields(Result, False);
end;

function TDBConnection.getStudentByLDAPUser(ldap_user: string): TStudent;
function TDBConnection.getStudentByLDAPUserPattern(ldap_user: string): TStudent;
var
arr: ArrayOfStudents;
begin
DBError := nil;
SQLQuery.Close;
SQLQuery.SQL.Text := 'SELECT FROM student WHERE ldap_user = (:ldap_user)';
SQLQuery.SQL.Text := 'SELECT FROM student WHERE ldap_user LIKE (:ldap_user)';
SQLQuery.ParamByName('ldap_user').AsString := ldap_user;

try
Expand Down

0 comments on commit 77dad8b

Please sign in to comment.