<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Rolando,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Sorry if I misled you on the wrong track. You can't use `in` using pselect() or pselectOne().
<br>
In order to use `in` you have to use run().</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0; margin-bottom:0">M<span class="_Xbe">é</span>lanie<br>
</p>
<br>
<p style="margin-top: 0px; margin-bottom: 0px;"></p>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> loris-dev-bounces@bic.mni.mcgill.ca <loris-dev-bounces@bic.mni.mcgill.ca> on behalf of Rolando Acosta <rolando.acosta@cnbp.ca><br>
<b>Sent:</b> January 16, 2020 10:55<br>
<b>To:</b> loris-dev@bic.mni.mcgill.ca <loris-dev@bic.mni.mcgill.ca><br>
<b>Subject:</b> [Loris-dev] Issue when trying to use "pselectOne" and "pselect" functions with an " IN " sql statement</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi LORIS team, <br>
<br>
A while ago I faced the following issue in one of the PRs I was working on:<br>
<div><br>
</div>
<div>/////////////////////////////////////////</div>
<div><br>
</div>
The structure:<br>
<br>
$recruitmentStartDate = $DB->pselectOne(<br>
"SELECT MIN(Date_registered)<br>
FROM candidate<br>
<b> WHERE RegistrationCenterID IN (:Sites)",<br>
array('Sites' => implode(",", array_keys($list_of_sites)))</b><br>
);<br>
<br>
Doesn't seem to be working for me. Only the first element of the array $list_of_sites is been passed to the IN SQL clause. Not sure if I'm using correctly this way. For the moment I write it as:<br>
<br>
$recruitmentStartDate = $DB->pselectOne(<br>
"SELECT MIN(Date_registered)<br>
FROM candidate<br>
<b>WHERE RegistrationCenterID IN (" . $sitesString . ")",<br>
array()</b><br>
);<br>
<div><br>
</div>
<div>//////////////////////////////////////////////////</div>
<div><br>
</div>
<div><br>
</div>
I'm having the same behavior with the function <b>pselect(string $query, array $params): array</b><br>
from the <b>class Database</b>.<br>
<br>
I'm wondering if you could take a look and see if there is a way to pass an array as one of the elements in the
<b>$params</b> array? The issue rises when need to do an IN statement as part of the query.<br>
<br>
Cheers,<br>
Rolando Acosta (CHU Sainte-Justine)</div>
</div>
</body>
</html>