From 77dad8bf08dcec34aa730d616c5df7404d54e22f Mon Sep 17 00:00:00 2001 From: Michael Brunklaus Date: Fri, 10 Mar 2017 08:58:35 +0100 Subject: [PATCH] issue #106 Identify by school username implemented pattern search --- lazarus/DBConnection.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lazarus/DBConnection.pas b/lazarus/DBConnection.pas index 9197ebf..bf91220 100644 --- a/lazarus/DBConnection.pas +++ b/lazarus/DBConnection.pas @@ -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 @@ -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