From 19e66ab781c7b0725b8739ecb1b5dc77d2537ec0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Feb 2014 13:59:41 -0600 Subject: Committer: root On branch master --- wqflask/maintenance/dataset/datastructure.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'wqflask/maintenance') diff --git a/wqflask/maintenance/dataset/datastructure.py b/wqflask/maintenance/dataset/datastructure.py index 97d8f91f..ce588c78 100644 --- a/wqflask/maintenance/dataset/datastructure.py +++ b/wqflask/maintenance/dataset/datastructure.py @@ -58,8 +58,9 @@ def get_nextdataid_phenotype(): dataid = re[0] dataid += 1 return dataid - + def insert_strain(speciesid, strainname): + cursor = utilities.get_cursor() sql = """ INSERT INTO Strain SET @@ -70,15 +71,16 @@ def insert_strain(speciesid, strainname): cursor.execute(sql, (strainname, strainname, speciesid)) def get_strain(speciesid, strainname): + cursor = utilities.get_cursor() sql = """ SELECT Strain.`Id`, Strain.`Name` FROM Strain WHERE Strain.`SpeciesId`=%s AND Strain.`Name` LIKE %s """ - cursor.execute(sql1, (speciesid, strainname)) + cursor.execute(sql, (speciesid, strainname)) return cursor.fetchone() - + def get_strain_sure(speciesid, strainname): strain = get_strain(speciesid, strainname) if not strain: @@ -86,5 +88,8 @@ def get_strain_sure(speciesid, strainname): strain = get_strain(speciesid, strainname) return strain -def get_strains_bynames(strainnames) - \ No newline at end of file +def get_strains_bynames(speciesid, strainnames): + strains = [] + for strainname in strainnames: + strains.append(get_strain_sure(speciesid, strainname)) + return strains -- cgit v1.2.3