import sqlite3
from sqlite3.dbapi2 import Connection
class Database:
def __init__(self, db_file):
self.connection = sqlite3.connect(db_file, check_same_thread=False)
self.cursor = self.connection.cursor()
def search_phone(self, phone):
with self.connection:
result = self.cursor.execute("SELECT * FROM `data` WHERE `phone` = ?", (phone,)).fetchall()
for item in result:
return item