Advertisement
wiley_pastebin

1.4 SQL1

Nov 18th, 2019
1,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.48 KB | None | 0 0
  1. import _mysql
  2. db = _mysql.CONNECT(”hostname”, ”username”, ”password”,DATABASE)
  3. db.query('''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, name VARCHAR(255), email VARCHAR(255))''')
  4. IN python, no RETURN VALUE FROM query(), but exceptions possible.
  5. Results
  6. res = db.store_result() #held IN client
  7. res = db.use_result() #held IN server
  8. res.fetchrow(max_rows)
  9. res.fetchrow()
  10. fetchrow() will never RETURN more than max_rows. WITHOUT a parameter the NUMBER IS 1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement