@@ -106,7 +106,7 @@ Okay, so you want to use ``_mysql`` anyway. Here are some examples.
106
106
107
107
The simplest possible database connection is::
108
108
109
- import _mysql
109
+ from MySQLdb import _mysql
110
110
db=_mysql.connect()
111
111
112
112
This creates a connection to the MySQL server running on the local
@@ -162,8 +162,8 @@ substitution, so you have to pass a complete query string to
162
162
WHERE price < 5""")
163
163
164
164
There's no return value from this, but exceptions can be raised. The
165
- exceptions are defined in a separate module, ``_mysql_exceptions ``,
166
- but ``_mysql `` exports them. Read DB API specification PEP-249 _ to
165
+ exceptions are defined in a separate module, ``MySQLdb._exceptions ``,
166
+ but ``MySQLdb. _mysql `` exports them. Read DB API specification PEP-249 _ to
167
167
find out what they are, or you can use the catch-all ``MySQLError ``.
168
168
169
169
.. _PEP-249 : https://www.python.org/dev/peps/pep-0249/
@@ -213,7 +213,7 @@ implicitly asked for one row, since we didn't specify ``maxrows``.
213
213
The other oddity is: Assuming these are numeric columns, why are they
214
214
returned as strings? Because MySQL returns all data as strings and
215
215
expects you to convert it yourself. This would be a real pain in the
216
- ass, but in fact, ``_mysql `` can do this for you. (And ``MySQLdb ``
216
+ ass, but in fact, ``MySQLdb. _mysql `` can do this for you. (And ``MySQLdb ``
217
217
does do this for you.) To have automatic type conversion done, you
218
218
need to create a type converter dictionary, and pass this to
219
219
``connect() `` as the ``conv `` keyword parameter.
0 commit comments