def fetchDefinition(mysql, word): sql_statement = "select dict_form from links where word_form like '" + word + "'" data = fetch_raw_data(mysql, sql_statement) queryEnd = '(' if (data): for item in data: queryEnd += "'" + item['dict_form'] + "'," queryEnd += "'" + word + "')" #print(queryEnd) sql_statement = "select * from google_defs where word in " + queryEnd resp = fetch_data(mysql, sql_statement) return resp
def fetchAllBooks(mysql): sql_statement = "select * from books order by book_id desc;" resp = fetch_data(mysql, sql_statement) return resp
def fetchTopWords(mysql): sql_statement = "select * from words order by word_form limit 100;" resp = fetch_data(mysql, sql_statement) return resp
def fetchAllWordsLike(mysql, word): sql_statement = "select * from pure_words where word_form like '" + word + "%' order by word_form;" resp = fetch_data(mysql, sql_statement) return resp
def fetchDefaultQuotes(mysql, bookid): sql_statement = "select * from sentences where book_id = " + str( bookid) + " LIMIT 2;" resp = fetch_data(mysql, sql_statement) return resp