[Zope] Zsql/DTML help needed

Bob Bunker bob.bunker@ljmc.org.uk
Wed, 25 Sep 2002 23:58:40 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C264EF.78ECEE70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Zope Community,

=20

I am a zope newbie and enjoying it!  I am helping someone build a =
database for storing musical scores.

=20

I am using ZSQL and trying to figure out how to do the following:  I =
want to do some inserts then a SELECT and then run some DTML on the =
result to wrap the result with html.  This all needs to happen from one =
html form.

=20

The inserts and the select is on metadata pertaining to some an external =
file, which needs to get created during this process.  My ZSQL inserts =
the metadata into the database and creates an ID. I want to use this ID =
as the file name.  So far I have this:

=20

INSERT INTO titles (
id, title) VALUES (
   nextval('titleseq'),
  <dtml-sqlvar title type=3Dnb>
)

=20

<dtml-var sql_delimiter>

=20

INSERT INTO pieces(
id, primarytitle, category, subcategory, notes, lyrics, editor, =
lastupdated
) VALUES (
 nextval('pieceseq'),
 currval('titleseq'),
 <dtml-sqlvar category type=3Dint>,
 <dtml-sqlvar subcategory type=3Dint optional>,
 <dtml-sqlvar notes type=3Dnb optional>,
 <dtml-sqlvar lyrics type=3Dnb optional>,
 <dtml-sqlvar editor type=3Dint optional>,
 CURRENT_TIMESTAMP
)

=20

<dtml-var sql_delimiter>

=20

INSERT INTO piecetitles (
piece, title) VALUES (
 currval('pieceseq'),=20
 currval('titleseq')=20
)

=20

<dtml-var sql_delimiter>

=20

INSERT INTO scorefiles (
id, piece, filetype, filesize, lastupdated) VALUES (
 nextval('scorefileseq'),
 currval('pieceseq'),
 <dtml-sqlvar filetype type=3Dint optional>,
 <dtml-sqlvar category type=3Dint optional>,
 CURRENT_TIMESTAMP
)
<dtml-var sql_delimiter>

=20

SELECT currval('pieceseq')=20

=20

<dtml-var sql_delimiter>

=20

So next I want to take the ID - which is retrieved from the SELECT at =
the end - and use it to create an External File (with the External file =
product).

=20

I am stuck on writing the DTML that first inserts the metadata and then =
creates the External File finally returning the user a confirmation =
displaying the record they have entered.

 =20

Kind Regards,

=20

Robert Bunker

www.ljmc.org.uk


------=_NextPart_000_000A_01C264EF.78ECEE70
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Dear Zope=20
Community,</SPAN><?xml:namespace prefix =3D o ns =3D=20
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am a zope newbie and =
enjoying=20
it!&nbsp; I am helping someone build a database for storing musical=20
scores.</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am using ZSQL and trying =
to figure=20
out how to do the following:&nbsp; I want to do some inserts then a =
SELECT and=20
then run some DTML on the result to wrap the result with html.&nbsp; =
This all=20
needs to happen from one html form.</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">The inserts and the select =
is on=20
metadata pertaining to some an external file, which needs to get created =
during=20
this process.&nbsp; My ZSQL inserts the metadata into the database and =
creates=20
an&nbsp;ID. I want to use this ID as the file name.&nbsp; So far I have=20
this:</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">INSERT INTO titles =
(<BR>id, title)=20
VALUES (<BR>&nbsp;&nbsp; nextval('titleseq'),<BR>&nbsp; &lt;dtml-sqlvar =
title=20
type=3Dnb&gt;<BR>)</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&lt;dtml-var=20
sql_delimiter&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">INSERT INTO pieces(<BR>id, =

primarytitle, category, subcategory, notes, lyrics, editor, =
lastupdated<BR>)=20
VALUES=20
(<BR>&nbsp;nextval('pieceseq'),<BR>&nbsp;currval('titleseq'),<BR>&nbsp;&l=
t;dtml-sqlvar=20
category type=3Dint&gt;,<BR>&nbsp;&lt;dtml-sqlvar subcategory type=3Dint =

optional&gt;,<BR>&nbsp;&lt;dtml-sqlvar notes type=3Dnb=20
optional&gt;,<BR>&nbsp;&lt;dtml-sqlvar lyrics type=3Dnb=20
optional&gt;,<BR>&nbsp;&lt;dtml-sqlvar editor type=3Dint=20
optional&gt;,<BR>&nbsp;CURRENT_TIMESTAMP<BR>)</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&lt;dtml-var=20
sql_delimiter&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">INSERT INTO piecetitles =
(<BR>piece,=20
title) VALUES (<BR>&nbsp;currval('pieceseq'), =
<BR>&nbsp;currval('titleseq')=20
<BR>)</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&lt;dtml-var=20
sql_delimiter&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">INSERT INTO scorefiles =
(<BR>id,=20
piece, filetype, filesize, lastupdated) VALUES=20
(<BR>&nbsp;nextval('scorefileseq'),<BR>&nbsp;currval('pieceseq'),<BR>&nbs=
p;&lt;dtml-sqlvar=20
filetype type=3Dint optional&gt;,<BR>&nbsp;&lt;dtml-sqlvar category =
type=3Dint=20
optional&gt;,<BR>&nbsp;CURRENT_TIMESTAMP<BR>)<BR>&lt;dtml-var=20
sql_delimiter&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">SELECT currval('pieceseq') =

</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&lt;dtml-var=20
sql_delimiter&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;</P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">So next I want to take the =
ID -=20
which is retrieved from the SELECT at the end -&nbsp;and use it to =
create an=20
External File (with the External file product).</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am stuck on writing the =
DTML that=20
first inserts the metadata and then creates the External File finally =
returning=20
the user a confirmation displaying the record they have=20
entered.</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm =
0pt">&nbsp;&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Kind =
Regards,</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Robert =
Bunker</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"><A=20
href=3D"http://www.ljmc.org.uk">www.ljmc.org.uk</A></SPAN></P></DIV></BOD=
Y></HTML>

------=_NextPart_000_000A_01C264EF.78ECEE70--