Usually cursor.rowcountgives you the number of query results.
However, for SQLite, this property is often set to -1 because of how SQLite produces the results. With the exception of the query COUNT(), you often will not know the number of results returned.
, SQLite , .
cursor.rowcount:
, Cursor sqlite3 , " " / " " .
executemany() rowcount.
API- Python rowcount -1, executeXX() , ". SELECT, , , , .
.
, :
data = sql.sqlExec("select (select count() from user) as count, * from user")
.
, cursor.fetchone() :
cursor.execute('SELECT * FROM user WHERE userid=?', (userid,))
row = cursor.fetchone()
if row is None:
raise ValueError('No such user found')
result = "Name = {}, Password = {}".format(row["username"], row["password"])