[Zope] Problem when using Z SQL Method and URL named field

Nitin Borwankar nitin@borwankar.com
Sun, 25 Nov 2001 16:52:06 -0800



Norman Khine wrote:
> 
> Hello,
> I don't know what/ and if this is correct, but perhaps somebody can check
> for me. I have a MySQL database connection with ZMySQLDA, and have the
> following table.
> 
> CREATE TABLE BusinessName (
>    BusID int(11) DEFAULT '0' NOT NULL auto_increment,
>    BusinessName varchar(40),
>    CompanyInfo text,
>    NoEmployees int(11),
>    Turnover int(11),
>    URL varchar(35),
>    Status int(2) DEFAULT '0' NOT NULL,
>    PRIMARY KEY (BusID)
> )
> 
> Here is my Z SQL Method
> 
> insert into BusinessName
>       (BusinessName, CompanyInfo, NoEmployees, Turnover, URL, Status)
> values
>       ('<dtml-var BusinessName>',
>        '<dtml-var CompanyInfo>',
>        '<dtml-var NoEmployees>',
>        '<dtml-var Turnover>',
>        '<dtml-var URL>',
>        '<dtml-var Status>')
> 
> The problem is that URL appends the path of where the object is based, to
> the url address I type, so that I get this:-

This happens because "URL" is a reserved word in Zope and resolves to
exactly what you're getting.
Try using an alternate name like companyURL for the form field name.
Also look at dtml-sqlvar in Appendix in the Zope Book online.
In general using dtml-sqlvar for inputs to ZSQL methods is recommended
and also more powerful.

Nitin Borwankar
nitin@borwankar.com


> 
> SQL used:
> 
> insert into BusinessName
>       (BusinessName, CompanyInfo, NoEmployees, Turnover, URL, Status)
> values
>       ('dfsfdfs',
>        'dsfsdfasf',
>        '12',
>        '1',
> 
> 'http://this-address.net//Tutorials/Zope_MySQL/methods/insert2/manage_test',
>        '1')
> 
> So how do I resolve this? Without having to rename the field name.
> 
> Thanks
> 
> Norman
> 
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> zz/********/z/****\zzz|****\*\zz|*******|z
> z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine
> zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net
> zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley
> z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK
> zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz
> zz/******/zz\******/zz|*|zzzzzzz|*|*****|z
> z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> 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 )

-- 
 --
 Nitin Borwankar
 nitin@borwankar.com