[Zope-DB] (no subject)

Gareth Evans g.evans@rms.co.uk
Thu, 19 Dec 2002 12:20:48 -0000


hi I've now changed the syntax after your good advice to be

select e.trap, e.datestamp, e.trapoid, e.trapfull, e.target,
e.enterprise, e.community,e.generictrap, e.version, e.severity, v.var,
v.num from snmp_trap_entry as e, snmp_trap_vars as v where =
e.auto=3Dv.auto
and e.auto=3D4

i still get a zope failure
Site Error
An error was encountered while publishing this resource.=20

Document Template Parse Error

Voyager Error
Voyager has encountered an error while publishing this resource.

Error Type: Document Template Parse Error
Error Value: No name given, for tag <dtml-var var null=3D"">, on line 47
of <string>






------------------------------------------------------------------------
--------

Troubleshooting Suggestions

The URL may be incorrect.=20
The parameters passed to this resource may be incorrect.=20
A resource that this resource relies on may be encountering an error.=20
If the error persists please contact the site maintainer. Thank you for
your patience.=20
=20

Traceback (innermost last):
  File D:/WABox\lib\python\ZPublisher\Publish.py, line 150, in
publish_module
  File D:/WABox\lib\python\ZPublisher\Publish.py, line 114, in publish
  File D:/WABox\lib\python\Zope\__init__.py, line 159, in
zpublisher_exception_hook
    (Object: mysql_get_trap_details)
  File D:/WABox\lib\python\ZPublisher\Publish.py, line 98, in publish
  File D:/WABox\lib\python\ZPublisher\mapply.py, line 88, in mapply
    (Object: manage_test)
  File D:/WABox\lib\python\ZPublisher\Publish.py, line 39, in
call_object
    (Object: manage_test)
  File D:/WABox\lib\python\Shared\DC\ZRDB\DA.py, line 325, in
manage_test
    (Object: mysql_get_trap_details)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 411, in
__call__
    (Object: <string>)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 340, in
cook
    (Object: <string>)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 170, in
parse
    (Object: <string>)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 223, in
parse_block
    (Object: <string>)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 177, in
parse
    (Object: <string>)
  File D:/WABox\lib\python\DocumentTemplate\DT_String.py, line 58, in
parse_error
    (Object: <string>)
Document Template Parse Error: (see above)

I cut and pasted the syntax into a file called out.txt and ran it like
this

e:/mysql/bin/mysql.exe -D wabox -e "select e.trap, e.datestamp,
e.trapoid, e.trapfull, e.target, e.enterprise,
e.community,e.generictrap, e.version, e.severity, v.var, v.num from
snmp_trap_entry as e, snmp_trap_vars as v where e.auto=3Dv.auto and
e.auto=3D4"

and got the following

trap	datestamp	trapoid	trapfull	target	enterprise
community	generictrap	version	severity	var	num
LINKDOWN	2002-12-17 16:52:36	0	NULL	192.0.2.1/161
NULL	NULL	NULL	NULL	1	4	1

so why doesn't it work in zope?



-----Original Message-----
From: zope-db-admin@zope.org [mailto:zope-db-admin@zope.org]On Behalf Of
Matthew T. Kromer
Sent: 19 December 2002 11:11
To: Gareth Evans
Cc: zope-db@zope.org
Subject: Re: [Zope-DB] (no subject)



On Thursday, December 19, 2002, at 06:00 AM, Gareth Evans wrote:

> hi I'm using
> (Zope 2.5.1 (binary release, python 2.1, win32-x86), python 2.1.3, =20
> win32)
> with
> ZMySQLDA (Installed product ZMySQLDA (ZMySQLDA 2.0.8))  =20
> <ZMySQLDA/manage_workspace>
> this seems to work fine for simple selects inserts etcetera but I'm =20
> trying to do the following join in a z sql method
>
>
> select * from snmp_trap_entry, snmp_trap_vars where =20
> snmp_trap_vars.auto=3Dsnmp_trap_entry.auto and snmp_trap_vars.auto=3D4
>
> I get the following failure
> Error Type: ValueError
> Error Value:
> Voyager Error Voyager has encountered an error while publishing this =20
> resource. Error Type: ValueError Error Value: Duplicate column name, =20
> auto=09
>
> the above command works fine when I run it from the mysql prompt
>
> auto	trap	datestamp	trapoid	trapfull	target
enterprise	community	=20
> generictrap	specifictrap	version	severity	ack	auto
var	num
> 4	LINKDOWN	2002-12-17 =20
> 16:52:36	0	NULL	192.0.2.1/161	NULL	NULL	NULL
NULL	NULL	1	0	4	4	1
>
>
You'll note the column "auto" shows up twice in your results, because =20
you ask for it from both tables.  Zope doesn't know that it is the same

column, constrained by the join, so it complains.

You can use Select column AS column1 notation to work around this, =20
although that is more clumsy to type.


_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://lists.zope.org/mailman/listinfo/zope-db

_____________________________________________________________________
This=20message=20has=20been=20checked=20for=20all=20known=20viruses=20by=20=
the=20
RMS=20Services=20Ltd=20Virus=20Scanning=20Service.=20For=20further=20infor=
mation=20visit
http://www.rms.co.uk.co.uk=20or=20call=20UK=2001454=20281265