我已连接套接字并且工作正常,但我是sqlite3的新手,不知道如何查询数据库,然后通过套接字连接发送查询结果。这就是我所拥有的,并且我确信当查询正确放入套接字时它将起作用。谢谢!
ssl_sock = context.wrap_socket(raw_sock, server_side=True)
ssl_sock.sendall('Here comes my database.'.encode('ascii'))
connection = sqlite3.connect("Clients")
clients = connection.execute("SELECT * FROM clients")
read = clients.readline()
ssl_sock.sendall(read)
ssl_sock.close()
File "database_server.py", line 48, in <module>
server(args.host, args.port, args.s, args.a)
文件“database_server.py”,第34行,在服务器中 read = clients.read() AttributeError:'sqlite3.Cursor'对象没有属性'read'