def findAnimalDescriptionFromWetland(): conn = databaseConnect.getWetlandConn() cur = conn.cursor() cur.execute('select ScientificName,ID from animal') results = cur.fetchall() cur.close() conn.close() return results
def findArticleDescription(): conn = databaseConnect.getWetlandConn() cur = conn.cursor() count = cur.execute('select * from article') results = cur.fetchall() cur.close() conn.close() # for result in results: # print result[7] return results
def findAnimal_copyDescription(): conn = databaseConnect.getWetlandConn() cur = conn.cursor() count = cur.execute('select ScientificName,ID from animal_copy1') results = cur.fetchall() cur.close() conn.close() # for result in results: # print result[7] return results
def updateAnimal(results): conn = databaseConnect.getWetlandConn() cur = conn.cursor() for result in results: print(result[0]) cur.execute('update animal_copy1 set ScientificName=%s where ID=%s', (reg(result[0]), result[1])) conn.commit() cur.close() conn.close()
def updateAnimal(list1, list2): num = 0 count = 1010 for m in list1: for n in list2: if (m[0] == n[0]): conn = databaseConnect.getWetlandConn() cur = conn.cursor() cur.execute( 'update animal_copy1 set ID=%s where ScientificName=%s', (count, n[0])) conn.commit() cur.close() conn.close() count = count + 1 num = num + 1 else: continue print("update animal id process complete,the count is:") print(num) print(count)