Skip to content

Commit

Permalink
Merge pull request #1321 from tripal/1320-tv3-fix-null-pub-check
Browse files Browse the repository at this point in the history
Issue 1320 null pub sql correction for GFF3 loader
  • Loading branch information
laceysanderson committed Dec 1, 2022
2 parents ab0afb2 + b4f8272 commit baff6e3
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions tripal_chado/includes/TripalImporter/GFF3Importer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -822,26 +822,22 @@ class GFF3Importer extends TripalImporter {
$select = ['uniquename' => 'null'];
$result = chado_select_record('pub', ['*'], $select);
if (count($result) == 0) {
// Insert the null pub.
$pub_sql = "
INSERT INTO {pub} (uniquename,type_id)
VALUES (:uname,
(SELECT cvterm_id
FROM {cvterm} CVT
INNER JOIN {dbxref} DBX ON DBX.dbxref_id = CVT.dbxref_id
INNER JOIN {db} DB ON DB.db_id = DBX.db_id
WHERE CVT.name = :type_id))
FROM {cvterm} CVT
WHERE CVT.name = :cvterm_name
AND cv_id = (SELECT cv_id
FROM {cv} CV
WHERE CV.name = :cv_name
)
)
)
";
$status = chado_query($psql);
if (!$status) {
$this->logMessage("Cannot prepare statement 'ins_pub_uniquename_typeid.", [], TRIPAL_WARNING);
return 0;
}

// Insert the null pub.
$result = chado_query($pub_sql, [
':uname' => 'null',
':type_id' => 'null',
])->fetchObject();
$pub_args = [':uname' => 'null', ':cvterm_name' => 'null', ':cv_name' => 'null'];
$result = chado_query($pub_sql, $pub_args)->fetchObject();
if (!$result) {
$this->logMessage("Cannot add null publication needed for setup of alias.", [], TRIPAL_WARNING);
return 0;
Expand Down

0 comments on commit baff6e3

Please sign in to comment.