Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
EPUB - 138.0Kb
HTML Download (TGZ) - 85.6Kb
HTML Download (Zip) - 103.4Kb


10.2.13 MySQLConnection.cmd_query() Method

Syntax:

cnx.cmd_query(statement)

This method sends the given statement to the MySQL server and returns a result. To send multiple statements, use the cmd_query_iter() method instead.

The returned dictionary contains information depending on what kind of query was executed. If the query is a SELECT statement, the result contains information about columns. Other statements return a dictionary containing OK or EOF packet information.

Errors received from the MySQL server are raised as exceptions. An InterfaceError is raised when multiple results are found.

Returns a dictionary.


User Comments
Sign Up Login You must be logged in to post a comment.