Re: [Zope] Problem with DTML and JOINS(ZSQL)

2008-04-15 Thread Peter Bengtsson
Zope is agnostic of whatever SQL you enter. In other words, they
compile differently and their errors are completely different.
I suggest you do this:

1. Fake the ZSQL to make sure your DTML is correct by changing the SQL
to something like this:
  SELECT 'drug_name_test', 'route_of_admin_test', etc.

2. Then write the ZSQL properly with the correct SQL syntax that you
want to use and as you're developing this, test it using the ZSQL
Method's Test tab rather than testing it via your custom DTML
application.

3. Run together.


PS. Tip: I always name my ZSQL methods something like
select_all_drug_zsql or UpdateOneDrug.sql just to avoid confusion when
I'm later working on the application. 'drug' isn't a suitable name of
a function/method.

On 15/04/2008, member madhangc <[EMAIL PROTECTED]> wrote:
> Dear all, I am developing a web application for a biological research
> institute down here in india. I have some
> problem in using JOINS. The below is the queries i used,
>
> SQL query
>
> File name : drug
>  select drug_name,dtype from bio_info_schema.drug order by dtype
>
> File name:drug_gene_details
> Note : i used both the sql queries seperately, but neither one worked.
>
> SELECT
> drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name
>  FROM drug,drug_gene
> WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name= drug_name type=string>
>
> SELECT
> drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name
>  FROM drug INNER JOIN drug_gene
> ON drug.drug_name = drug_gene.drug_name AND drug.drug_name= drug_name type=string>
>
> Below is the DTML code i have used,
>
> File name : view_drug_detail
> 
>  
>  
>  Drug Name
>  
>  
>  
>  
>  
>  
>   href="http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/drug_gene_details/drug_name/ drug_name>/view_drug_info">
>  
>  
>  
>
> File name : view_drug_info
>  Drug Information
> Summary
>  
> 
>  Drug name
>  
> 
>  Route of Administration route_of_admin>
>  
> 
>  Dosage (Adult)
>  
> 
>  Dosage (Child)
>  
> 
>  Adverse Effects
>  
> 
>  Drug Type
>  
> 
>  Drug Targets
>  
> 
>
> This is the error which i got.
>
> Site Error
>
>  An error was encountered while publishing this resource.
> exceptions.KeyError
>  Sorry, a site error occurred.
> Traceback (innermost last):
>  * Module ZPublisher.Publish, line 150, in publish_module
> * Module ZPublisher.Publish, line 114, in publish
>  * Module Zope, line 134, in zpublisher_exception_hook
> * Module Shared.DC.ZRDB.DA, line 547, in __getattr__
>  KeyError: _r
> Troubleshooting Suggestions
>  * 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.
>
> Any kind of suggestion and help will be very useful. Thanks in advance.
>
> --
> Best Regards
> \madhan
>
> Things must be learned only to be unlearned again or, more likely, to be
> corrected.
>  -- Richard Feynman
> ___
>  Zope maillist  -  Zope@zope.org
>  http://mail.zope.org/mailman/listinfo/zope
>  **   No cross posts or HTML encoding!  **
>  (Related lists -
>   http://mail.zope.org/mailman/listinfo/zope-announce
>   http://mail.zope.org/mailman/listinfo/zope-dev )
>
>


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Problem with DTML and JOINS(ZSQL)

2008-04-15 Thread Jaroslav Lukesh
Did you try the Test tab at ZSQL method management page? If it does not 
work, you will get error from SQL server. If it works and you does not get 
any data, then your query is not fit to any data.


- Original Message - 
From: member madhangc

To: zope@zope.org
Sent: Tuesday, April 15, 2008 1:08 PM
Subject: [Zope] Problem with DTML and JOINS(ZSQL)


Dear all, I am developing a web application for a biological research 
institute down here in india. I have some

problem in using JOINS. The below is the queries i used,

SQL query

File name : drug
select drug_name,dtype from bio_info_schema.drug order by dtype

File name:drug_gene_details
Note : i used both the sql queries seperately, but neither one worked.

SELECT 
drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name

FROM drug,drug_gene
WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=drug_name type=string>


SELECT 
drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name

FROM drug INNER JOIN drug_gene
ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=drug_name type=string>



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )