[Zope] ZSQL question
Colin Fox
cfox@crystalcherry.com
27 Mar 2002 13:57:47 -0800
--=-18/6rDdFSCEbCUx5QcQa
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
On Wed, 2002-03-27 at 13:49, Bryan C. Andregg wrote:
<..>
>=20
> You could do something like this
>=20
> <dtml-if "REQUEST.has_attr(cb)">
> <dtml-call dbInsert(str1 =3D REQUEST[str1],
> str2 =3D REQUEST[str2],
> cb =3D REQUEST[cb] )">
> <dtml-else>
> <dtml-call dbInsert(str1 =3D REQUEST[str1],
> str2 =3D REQUEST[str2],
> cb =3D '' )">
> </dtml-if>
Actually, I discovered moments after posting my question that there's an
'optional' keyword, so my statement can now read:
insert into mytable(col1,col2,col3)
values
(<dtml-sqlvar str1 type=3D"string">,
<dtml-sqlvar str2 type=3D"string">,
<dtml-sqlvar cb type=3D"string" optional>
)
and it will work (assuming the col3 column accepts nulls).
--=20
Colin Fox cfox@crystalcherry.com
CF Consulting Inc. GPG Fingerprint:
D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
--=-18/6rDdFSCEbCUx5QcQa
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQA8okBao+tuo7yXVy8RAixVAKCMh/UrpxITkoz1NFwCniOdOiEjIACfbDwU
+WXQc46moAqthZWlOcbfUX0=
=r2oN
-----END PGP SIGNATURE-----
--=-18/6rDdFSCEbCUx5QcQa--