#39 no server_capabilities attribute

MySQLdb-0.9.2
closed
Andy Dustman
ZMySQLDA (19)
5
2012-09-19
2002-08-16
Anonymous
No

Didn't research this in any detail at all, just did
what I needed to get me going, and submitting this in
case someone wants to know.

Installed MySQLdb-0.9.2 and ZMySQLDA 2.0.8 on FreeBSD
with MySQL 3.23.48 (no idea of the details of these
versions, I'm not the sys admin).

ZMySQLDA product installed OK, but in trying to
instantiate a db connection, got an error that
attribute server_capabilities could not be found.
Traced the problem to line 183 of db.py, where I
cynaged the offending line to set the value manually to
0 instead of attempting to look up the value in that
attribute. Not the best solution, but it got me unstuck.

Discussion

  • Logged In: NO

    Oh yeah, I did have to use -lmysqlclient instead of
    -lmysqlclient_r when I built mysqldb.

     
  • Andy Dustman
    Andy Dustman
    2002-08-17

    Logged In: YES
    user_id=71372

    What version of python? I'm guessing 2.1.3 since you are
    using Zope, but I'll like to know.

     
  • Logged In: NO

    Python version: No, I'm afraid it's 2.2. I had told the
    owner of the server that 2.2 was not currently supported by
    Zope 2.5, but for some reason he used that version anyway,
    and as Zope seemed to work fine (for a while now), I didn't
    complain (he's donating the space, so I want to cut him some
    slack).

    If's that's the problem, then I can hardly blame your product!

     
  • Andy Dustman
    Andy Dustman
    2002-08-18

    Logged In: YES
    user_id=71372

    That may be part of the problem. 2.2 is definitely
    supported, but there are changes between 2.1 and 2.2 in the
    handling of attributes, and I may have introduced a bug.

     
  • Andy Dustman
    Andy Dustman
    2002-08-18

    Logged In: YES
    user_id=71372

    OK, I think I can reproduce this now. It doesn't happen
    using MySQLdb, only _mysql. Trying to figure out why.

     
  • Bernd Rothert
    Bernd Rothert
    2003-03-18

    Logged In: YES
    user_id=35362

    In fact there are no attributes at all (>=Python-2.2), just
    methods in the connection object. The part for retrieving
    attributes in "_mysql_ResultObject_getattr" (_mysql.c) is
    disabled for "PY_VERSION_HEX >= 0x02020000"
    (struct PyMemberDef is incompatible with PyMember_Get). You
    can get ahead with a 2.2 version of PyMember_Get. This is
    what I did to use ZMySQLDA under Python-2.2.2:

    if PY_VERSION_HEX >= 0x02020000

    static PyObject
    MyPyMember_Get(char
    self, MyMemberlist(member_list), char
    name)
    {
    MyMemberlist(l);
    for (l = member_list; l->name != NULL; l++) {
    if (strcmp(l->name, name) == 0)
    return PyMember_GetOne((char
    )self, l);
    }
    PyErr_SetString(PyExc_AttributeError, name);
    return NULL;
    }

    endif

    Change
    MyMemberlist(x) struct PyMemberDef x
    to
    MyMemberlist(x) PyMemberDef x

    And this in the 2 _getattr methods:
    return MyPyMember_Get((char *)self,
    _mysql_ConnectionObject_memberlist, name);

    Best regards
    Bernd Rothert

     
  • Andy Dustman
    Andy Dustman
    2003-07-07

    Logged In: YES
    user_id=71372

    This has been fixed in the current CVS tree.