mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 03:50:43 +08:00

methods to the Result object. Also need to rip out the Field object; ended up not needing it. It's just cruft now. Python 1.5.2b2 (#1, Feb 18 1999, 18:20:08) [GCC egcs-2.90.29 980515 (egcs-1.0.3 re on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import _mysql >>> c=_mysql.connect(passwd='foobar',db='vmail') >>> c.query("insert into Users (Name, Mailbox, Forward) values ('Ed Landa', 'elanda', 'elanda@beavis.comstar.net')") >>> c.affected_rows() 1L >>> c.query("select * from Users") >>> r=c.store_result() >>> r.describe() (('Handle', 253, 0, 16, 16, 0, 1), ('UNIXpasswd', 253, 0, 16, 16, 0, 1), ('Name', 253, 8, 64, 64, 0, 1), ('Mailbox', 253, 8, 64, 64, 0, 0), ('DomainName', 253, 0, 64, 64, 0, 0), ('Forward', 252, 25, 65535, 65535, 0, 1), ('Secret', 253, 0, 64, 64, 0, 1), ('Active', 2, 0, 6, 6, 0, 1), ('MailQuota', 2, 0, 6, 6, 0, 1), ('Priv', 2, 0, 6, 6, 0, 1), ('Updated', 7, 14, 14, 14, 0, 0), ('AcctUpdate', 2, 0, 6, 6, 0, 1), ('RefNo', 3, 0, 11, 11, 0, 1), ('MailboxHash', 253, 0, 32, 32, 0, 1)) >>> r.fetch_row() (None, None, 'Andy', 'adustman', '', None, None, None, None, None, '19990312021455', None, None, None) >>> r.fetch_row() (None, None, 'Ed Landa', 'elanda', '', 'elanda@beavis.comstar.net', None, None, None, None, '19990312022659', None, None, None) >>> r.fetch_row() >>> Notes: NULL values represented by Python None object. fetch_row() returns None at the end of the query set, which doesn't print. Conversion of data types will be done in a Python wrapper module. Need to figure out a way to read a fixed number of rows without having to twiddle with the global interpreter lock all the time. Not a big problem if store_result() has been used, but is trickier if use_result() was used.