Re: [Zope] Odd SQL errors- HELP

2000-10-09 Thread Andrew Kenneth Milton

+---[ Jon Franz ]--
|
| +---+--+--+-+-++
| | Field | Type | Null | Key | Default | Extra  |
| +---+--+--+-+-++
| | id| mediumint(8) |  | PRI | 0   | auto_increment |
| | value | varchar(32)  |  | | ||
| +---+--+--+-+-++
| 
| Now, at first i thought it was the field name of 'id' causing 
| the problem, but now I've tried renaming the field and its still a no-go.
| I can do queries such as 'select value from reason' fine, but if i select
| * or the id field, it chokes... Looking through the mailinglist archives,
| I think its a 'mapping error' where the ZmySQLDA doesn't properly map
| this type of field for some reason... can someone help me solve this
| problem?

The problem is likely to be your mediumint field, which is probably not
mapped to a python type.

You should let us know what version of MySQL DA you have.
Also be aware that the DA is not a part of Zope, and has been contributed
by a 3rd party.

Anyway if you want to have a crack at fixing it, look in the
ZMySQLDA directory in a file called db.py. You could add an entry with

"medium int":"i" 

or permutations of the above. (You can test it I can't, so little point in 
me doing it when its this simple).

-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd  |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068|[EMAIL PROTECTED]| 

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Odd SQL errors- HELP

2000-10-09 Thread Jon Franz

Hello, I have Zope 2.2.2 running with a MySQL database, and 
everything _was_ working fine until I started to play with 
the new database structure our dba came up with for tracking
our recruiting process...
anyway, i have a db named recruit, with a MySQLDA connection
object to it that works, but on mnay of the tables I get an error
such as the one pasted below when I attempt to do a simple query...
Now, the state table does not return this error and has this 
structure: (as cut-n-pasted from the mysql monitor)
+---+-+--+-+-+---+
| Field | Type| Null | Key | Default | Extra |
+---+-+--+-+-+---+
| state | char(2) |  | PRI | |   |
+---+-+--+-+-+---+

meanwhile any of our tables with 'id' fields choke with
the keyerror: unhandled, heres an example table struct:
+---+--+--+-+-++
| Field | Type | Null | Key | Default | Extra  |
+---+--+--+-+-++
| id| mediumint(8) |  | PRI | 0   | auto_increment |
| value | varchar(32)  |  | | ||
+---+--+--+-+-++

Now, at first i thought it was the field name of 'id' causing 
the problem, but now I've tried renaming the field and its still a no-go.
I can do queries such as 'select value from reason' fine, but if i select
* or the id field, it chokes... Looking through the mailinglist archives,
I think its a 'mapping error' where the ZmySQLDA doesn't properly map
this type of field for some reason... can someone help me solve this
problem?
Yes, I can change the db, but thats really not an acceptable option, since
the dba will then just go 'Well, if zope cant handle a simple db structure
without changing field name and/or types, then i refuse to sign off on
using zope as a development tool!'

>>>


Zope Error

Zope has encountered an error while publishing this resource.

Error Type: KeyError
Error Value: unhandled

Troubleshooting Suggestions
This resource may be trying to reference a nonexistent object or variable
unhandled.
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.

For more detailed information about the error, please refer to the HTML
source for this page.

If the error persists please contact the site maintainer. Thank you for your
patience.

Traceback (innermost last):
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /usr/local/zope/2.2.0/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
(Object: RoleManager)
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 171, in
publish
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: manage_test)
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(Object: manage_test)
  File /usr/local/zope/2.2.0/lib/python/Shared/DC/ZRDB/Connection.py, line
180, in manage_test
(Object: RoleManager)
  File lib/python/Products/ZMySQLDA/db.py, line 191, in query
KeyError: (see above)

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )