Execute a SQL query against the database.
Cursor.execute(query [,args])
| query | The select statement to be executed |
| args | A tuple of one or more parameters to be inserted wherever a question mark appears in the query string. |
This method executes a SQL query against the database. This is a DB API compliant call. Parameters are substituted using question marks, e.g. "SELECT name FROM table WHERE id=?". The parameter args is a tuple. It returns None on success or raises an exception in the case of an error.
| None | The query was executed successfully |
conn = db.connect()
cursor = conn.cursor()
cursor.execute("SELECT * FROM Metatable WHERE TableName='%s'" % clsname)
res = cursor.fetchall()
...
cursor.close()
conn.rollback()