Skip to content

Commit

Permalink
[Genomic_Browser] select to pselect (#3454)
Browse files Browse the repository at this point in the history
This removes the last DB->select by changing them to pselect which use prepared statements.

Cleans the "PHP Warning: Missing argument 2 for Database::select()" message in the error log.
  • Loading branch information
xlecours authored and driusan committed Jan 31, 2018
1 parent ea96985 commit d1f1a86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions modules/genomic_browser/php/cnv_browser.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,9 @@ class CNV_Browser extends \NDB_Menu_Filter
$this->addBasicText('Gene_Symbol', 'Gene:');

$DB = \Database::singleton();
$platform_results = $DB->select(
"SELECT distinct Name FROM genotyping_platform"
$platform_results = $DB->pselect(
"SELECT distinct Name FROM genotyping_platform",
array()
);

$platform_options = array('' => 'Any');
Expand Down
8 changes: 4 additions & 4 deletions tools/excelDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function MapSubprojectID(&$results) {
//Get the names of all instrument tables
$query = "select * from test_names order by Test_name";
//$query = "select * from test_names where Test_name like 'a%' order by Test_name"; //for rapid testing
$DB->select($query, $instruments);
$instruments = $DB->pselect($query, array());

foreach ($instruments as $instrument) {
//Query to pull the data from the DB
Expand All @@ -94,7 +94,7 @@ function MapSubprojectID(&$results) {
$query = "select c.PSCID, c.CandID, s.SubprojectID, s.Visit_label, s.Submitted, s.Current_stage, s.Screening, s.Visit, f.Administration, e.full_name as Examiner_name, f.Data_entry, f.Validity, i.* from candidate c, session s, flag f, $Test_name i left outer join examiners e on i.Examiner = e.examinerID where c.PSCID not like 'dcc%' and c.PSCID not like '0%' and c.PSCID not like '1%' and c.PSCID not like '2%' and c.Entity_type != 'Scanner' and i.CommentID not like 'DDE%' and c.CandID = s.CandID and s.ID = f.sessionID and f.CommentID = i.CommentID AND c.Active='Y' AND s.Active='Y' order by s.Visit_label, c.PSCID";
}
}
$DB->select($query, $instrument_table);
$instrument_table = $DB->pselect($query, array());
MapSubprojectID($instrument_table);
writeExcel($Test_name, $instrument_table, $dataDir);

Expand All @@ -106,7 +106,7 @@ function MapSubprojectID(&$results) {
$Test_name = "candidate_info";
//this query is a but clunky, but it gets rid of all the crap that would otherwise appear.
$query = "select distinct c.PSCID, c.CandID, c.Gender, c.DoB, s.SubprojectID from candidate c, session s where c.CandID = s.CandID and c.Active='Y' and s.CenterID <> 1 and s.CenterID in (select CenterID from psc where Study_site='Y') order by c.PSCID";
$DB->select($query, $results);
$results = $DB->pselect($query, array());

MapSubprojectID($results);
writeExcel($Test_name, $results, $dataDir);
Expand All @@ -117,7 +117,7 @@ function MapSubprojectID(&$results) {
*/
$Test_name = "DataDictionary";
$query = "select Name, Type, Description, SourceField, SourceFrom from parameter_type where SourceField is not null order by SourceFrom";
$DB->select($query, $dictionary);
$dictionary = $DB->pselect($query, array());
writeExcel($Test_name, $dictionary, $dataDir);

//MRI data construction
Expand Down

0 comments on commit d1f1a86

Please sign in to comment.