[Zope] Get Column Names from SQL Query?

Laurie Nason laurien@tiger.bcm.tmc.edu
Mon, 9 Apr 2001 13:34:30 -0500


OK this helps, but what I am trying to do is to generate a general report
for any table - if I use the following dtml - how do I access the actual
data retrieved by the query? I could call the query again and get the data
but in terms of efficiency that is not too practical. I have looked for the
dtml that is called when a query is tested but haven't found it yet!

<dtml-with "queries.qrytest()">

<table border=1 >
	<tr>
		<dtml-in names>
			<th><dtml-var sequence-item></th>
		</dtml-in>
	</tr>
<dtml-comment> I WANT TO PUT THE DATA FROM THE QUERY HERE </dtml-comment>
	<tr>
		<dtml-in ??????>
			<td><dtml-var ????></td>
		</dtml-in>
	</tr>
</table>
</dtml-with>


-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jose
Soares
Sent: Monday, April 09, 2001 2:51 AM
To: Laurie Nason
Cc: Thomas B. Passin; Zope Mailing List
Subject: Re: [Zope] Get Column Names from SQL Query?


Have you tried:
http://www.zope.org/Members/teyc/howtoSQLVariables

Jose'

Laurie Nason wrote:

> I have found something that does this but haven't managed to make it work
as
> I want it to yet!
> <dtml-let Fields="queries.qryreturnallusers().names()">
>                 <dtml-in Fields>
>                         <dtml-var sequence-item></p>
>                 </dtml-in>
> </dtml-let>
> This gives the column headers
> If anyone knows of a way of doing this which gives the data as well as the
> headers in one fail swoop then let me know too.
>
> Laurie
>
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Thomas B. Passin
> Sent: Wednesday, April 04, 2001 10:51 AM
> To: Zope Mailing List
> Subject: [Zope] Get Column Names from SQL Query?
>
> I want to run an SQL query, like
>
> select * from person
>
> Then I want to extract the column names from the returned data.  In other
> words, I don't want to hand-code them into the result page.
>
> I know how to do this in Cold Fusion, but I don't know how in Zope.
>
> I'm using a ZSQL method, of course, to query the database.
>
> Anyone know how to do this without running an external method?
>
> Tom P
>
> _______________________________________________
> 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 )
>
> _______________________________________________
> 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 )


_______________________________________________
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 )