Skip to content

Commit

Permalink
Merge pull request #177 from LOVDnl/fix/strict_mysql_errors
Browse files Browse the repository at this point in the history
Fix MySQL errors during installation on newer MySQL versions
  • Loading branch information
mkroon1 authored Jan 31, 2017
2 parents fe06dbb + c555a6c commit 8dfe238
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 31 deletions.
5 changes: 5 additions & 0 deletions src/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"ONLY_FULL_GROUP_BY" MySQL setting.
Closes #167: "Manage transcripts feature doesn't allow addition of transcript
anymore".
* Fixed several problems with MySQL's new default strict mode. LOVD wasn't
installable, and transcripts couldn't be created if this setting was enabled.
Closes #143: "LOVD won't install with error "Invalid default value for
'start_date'""
Closes #173: "Installation failed on ubuntu 16"
* Fixed bug; The "all variants affecting transcripts" view showed only one
entry. This was caused by the recent changes making LOVD compatible with the
new default "ONLY_FULL_GROUP_BY" MySQL setting.
Expand Down
12 changes: 6 additions & 6 deletions src/class/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-08-17
* Modified : 2016-10-14
* For LOVD : 3.0-18
* Modified : 2017-01-25
* For LOVD : 3.0-19
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Copyright : 2004-2017 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
*
*
* This file is part of LOVD.
Expand Down Expand Up @@ -59,7 +59,7 @@ function __construct ($sBackend, $sDSN, $sUsername = '', $sPassword = '')
// Still needs check though, in case two PDO connections are opened.
define('MYSQL_ATTR_INIT_COMMAND', 1002);
}
$aOptions = array(MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE);
$aOptions = array(MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8, SQL_MODE = REPLACE(@@SQL_MODE, "NO_ZERO_DATE", "")', PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE);
}
try {
parent::__construct($sDSN, $sUsername, $sPassword, $aOptions);
Expand Down
19 changes: 10 additions & 9 deletions src/genes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-15
* Modified : 2016-10-14
* For LOVD : 3.0-18
* Modified : 2017-01-25
* For LOVD : 3.0-19
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Msc. Daan Asscheman <D.Asscheman@LUMC.nl>
* Copyright : 2004-2017 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
* David Baux <david.baux@inserm.fr>
* M. Kroon <m.kroon@lumc.nl>
*
Expand Down Expand Up @@ -522,6 +522,7 @@ function lovd_prepareCuratorLogMessage($sGeneID, $aCurators, $aAllowEdit, $aShow
'id_protein_ncbi' => $zData['transcriptsProtein'][$sTranscript],
'id_protein_ensembl' => '',
'id_protein_uniprot' => '',
'remarks' => '',
'position_c_mrna_start' => $zData['transcriptPositions'][$sTranscript]['cTransStart'],
'position_c_mrna_end' => $zData['transcriptPositions'][$sTranscript]['cTransEnd'],
'position_c_cds_end' => $zData['transcriptPositions'][$sTranscript]['cCDSStop'],
Expand Down Expand Up @@ -549,9 +550,9 @@ function lovd_prepareCuratorLogMessage($sGeneID, $aCurators, $aAllowEdit, $aShow
$sTranscriptName = $zData['transcriptNames'][$sTranscript];
$aTranscriptPositions = $zData['transcriptPositions'][$sTranscript];
// Add transcript to gene.
$q = $_DB->query('INSERT INTO ' . TABLE_TRANSCRIPTS . '(id, geneid, name, id_mutalyzer, id_ncbi, id_ensembl, id_protein_ncbi, id_protein_ensembl, id_protein_uniprot, position_c_mrna_start, position_c_mrna_end, position_c_cds_end, position_g_mrna_start, position_g_mrna_end, created_date, created_by) ' .
'VALUES(NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)',
array($_POST['id'], $sTranscriptName, $nMutalyzerID, $sTranscript, '', $sTranscriptProtein, '', '', $aTranscriptPositions['cTransStart'], $aTranscriptPositions['cTransEnd'], $aTranscriptPositions['cCDSStop'], $aTranscriptPositions['chromTransStart'], $aTranscriptPositions['chromTransEnd'], $_POST['created_by']));
$q = $_DB->query('INSERT INTO ' . TABLE_TRANSCRIPTS . '(id, geneid, name, id_mutalyzer, id_ncbi, id_ensembl, id_protein_ncbi, id_protein_ensembl, id_protein_uniprot, remarks, position_c_mrna_start, position_c_mrna_end, position_c_cds_end, position_g_mrna_start, position_g_mrna_end, created_date, created_by) ' .
'VALUES(NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)',
array($_POST['id'], $sTranscriptName, $nMutalyzerID, $sTranscript, '', $sTranscriptProtein, '', '', '', $aTranscriptPositions['cTransStart'], $aTranscriptPositions['cTransEnd'], $aTranscriptPositions['cCDSStop'], $aTranscriptPositions['chromTransStart'], $aTranscriptPositions['chromTransEnd'], $_POST['created_by']));
if (!$q) {
// Silent error.
lovd_writeLog('Error', LOG_EVENT, 'Transcript information entry ' . $sTranscript . ' - ' . ' - could not be added to gene ' . $_POST['id']);
Expand Down
14 changes: 7 additions & 7 deletions src/install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2009-10-19
* Modified : 2016-10-14
* For LOVD : 3.0-18
* Modified : 2017-01-25
* For LOVD : 3.0-19
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Msc. Daan Asscheman <D.Asscheman@LUMC.nl>
* Copyright : 2004-2017 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
*
*
* This file is part of LOVD.
Expand Down Expand Up @@ -536,7 +536,7 @@ function lovd_printSideBar ()
// (10) Creating the "Healthy / Control" disease. Maybe later enable some more default columns? (IQ, ...)
$aInstallSQL['Registering phenotype columns for healthy controls...'] =
array(
'INSERT INTO ' . TABLE_DISEASES . ' (symbol, name, created_by, created_date) VALUES ("Healthy/Control", "Healthy individual / control", 0, NOW())',
'INSERT INTO ' . TABLE_DISEASES . ' (symbol, name, tissues, features, remarks, created_by, created_date) VALUES ("Healthy/Control", "Healthy individual / control", "", "", "", 0, NOW())',
'UPDATE ' . TABLE_DISEASES . ' SET id = 0',
'ALTER TABLE ' . TABLE_DISEASES . ' auto_increment = 1',
// FIXME: Rather parse inc-sql-columns then to do this manually.
Expand Down
19 changes: 10 additions & 9 deletions src/transcripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-21
* Modified : 2016-07-18
* For LOVD : 3.0-17
* Modified : 2017-01-25
* For LOVD : 3.0-19
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Msc. Daan Asscheman <D.Asscheman@LUMC.nl>
* Copyright : 2004-2017 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl>
*
*
Expand Down Expand Up @@ -331,6 +331,7 @@
'id_protein_ncbi' => $zData['transcriptsProtein'][$sTranscript],
'id_protein_ensembl' => '',
'id_protein_uniprot' => '',
'remarks' => '',
'position_c_mrna_start' => $zData['transcriptPositions'][$sTranscript]['cTransStart'],
'position_c_mrna_end' => $zData['transcriptPositions'][$sTranscript]['cTransEnd'], // Is actually sortableTransEnd.
'position_c_cds_end' => $zData['transcriptPositions'][$sTranscript]['cCDSStop'],
Expand All @@ -357,9 +358,9 @@
$sTranscriptName = $zData['transcriptNames'][$sTranscript];

$aTranscriptPositions = $zData['transcriptPositions'][$sTranscript];
$q = $_DB->query('INSERT INTO ' . TABLE_TRANSCRIPTS . '(id, geneid, name, id_mutalyzer, id_ncbi, id_ensembl, id_protein_ncbi, id_protein_ensembl, id_protein_uniprot, position_c_mrna_start, position_c_mrna_end, position_c_cds_end, position_g_mrna_start, position_g_mrna_end, created_date, created_by) ' .
'VALUES(NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)',
array($zData['gene']['id'], $sTranscriptName, $nMutalyzerID, $sTranscript, '', $sTranscriptProtein, '', '', $aTranscriptPositions['cTransStart'], $aTranscriptPositions['cTransEnd'], $aTranscriptPositions['cCDSStop'], $aTranscriptPositions['chromTransStart'], $aTranscriptPositions['chromTransEnd'], $_POST['created_by']));
$q = $_DB->query('INSERT INTO ' . TABLE_TRANSCRIPTS . '(id, geneid, name, id_mutalyzer, id_ncbi, id_ensembl, id_protein_ncbi, id_protein_ensembl, id_protein_uniprot, remarks, position_c_mrna_start, position_c_mrna_end, position_c_cds_end, position_g_mrna_start, position_g_mrna_end, created_date, created_by) ' .
'VALUES(NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)',
array($zData['gene']['id'], $sTranscriptName, $nMutalyzerID, $sTranscript, '', $sTranscriptProtein, '', '', '', $aTranscriptPositions['cTransStart'], $aTranscriptPositions['cTransEnd'], $aTranscriptPositions['cCDSStop'], $aTranscriptPositions['chromTransStart'], $aTranscriptPositions['chromTransEnd'], $_POST['created_by']));
if (!$q) {
// Silent error.
lovd_writeLog('Error', LOG_EVENT, 'Transcript information entry ' . $sTranscript . ' - could not be added to gene ' . $zData['gene']['id']);
Expand Down

0 comments on commit 8dfe238

Please sign in to comment.