using capitalize in dtml-var in sqlmethods
Hi everyone, I would like to capitalize an entry of a form before it goes into my db thus: INSERT INTO blengprojects (responsible, beamline, project_title, project_description, status,installdate_month, installdate_year,installdate, updated) values (<dtml-sqlvar responsible type="string">, <dtml-sqlvar beamline type="string">, <dtml-var project_title capitalize>, <dtml-var project_description capitalize>, <dtml-sqlvar status type="string" optional> <dtml-sqlvar status_other type="string" optional>, <dtml-sqlvar installdate_month type="int" optional>, <dtml-sqlvar installdate_year type="int" optional>, <dtml-if installdate_month> '<dtml-sqlvar installdate_year type="int" optional>/<dtml-sqlvar installdate_month type="int" optional>/01', <dtml-else>null, </dtml-if> <dtml-sqlvar updated type="string"> ) why does this give me the following???? Error, _mysql_exceptions.OperationalError: (1054, "Unknown column 'Upper' in 'field list'") SQL used: INSERT INTO blengprojects (responsible, beamline, project_title, project_description, status,installdate_month, installdate_year,installdate, updated) values ('robichon', 'id44', Upper, Upper, '' '', null, null, null, '2003/05/01' ) TIA Marie Robichon Web Task Force European Synchrotron Radiation Facility BP 220 38043 Grenoble Cedex France http://www.esrf.fr Tel: (33) 04 76 88 21 86 Fax: (33) 04 76 88 24 27
sqlvar automatically puts quotes around the thing it renders, var doesn't you have to wrap that yourself. On Fri, 06 Jun 2003 17:00:54 +0200, Marie Robichon <robichon@esrf.fr> wrote:
Hi everyone,
I would like to capitalize an entry of a form before it goes into my db thus:
INSERT INTO blengprojects (responsible, beamline, project_title, project_description, status,installdate_month, installdate_year,installdate, updated) values (<dtml-sqlvar responsible type="string">, <dtml-sqlvar beamline type="string">, <dtml-var project_title capitalize>, <dtml-var project_description capitalize>, <dtml-sqlvar status type="string" optional> <dtml-sqlvar status_other type="string" optional>, <dtml-sqlvar installdate_month type="int" optional>, <dtml-sqlvar installdate_year type="int" optional>, <dtml-if installdate_month> '<dtml-sqlvar installdate_year type="int" optional>/<dtml-sqlvar installdate_month type="int" optional>/01', <dtml-else>null, </dtml-if> <dtml-sqlvar updated type="string"> )
why does this give me the following????
Error, _mysql_exceptions.OperationalError: (1054, "Unknown column 'Upper' in 'field list'")
SQL used: INSERT INTO blengprojects (responsible, beamline, project_title, project_description, status,installdate_month, installdate_year,installdate, updated) values ('robichon', 'id44', Upper, Upper, '' '', null, null, null, '2003/05/01' )
TIA
Marie Robichon
Web Task Force European Synchrotron Radiation Facility BP 220 38043 Grenoble Cedex France
Tel: (33) 04 76 88 21 86 Fax: (33) 04 76 88 24 27
_______________________________________________ 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 )
-- Phil Harris
Marie Robichon wrote at 2003-6-6 17:00 +0200:
... I would like to capitalize an entry of a form before it goes into my db thus: ... <dtml-var project_title capitalize>,
Try: <dtml-sqlvar expr="project_title.capitalize()" column=project_title type=string> Dieter
At 21:03 06/06/2003 +0200, Dieter Maurer wrote:
Marie Robichon wrote at 2003-6-6 17:00 +0200:
... I would like to capitalize an entry of a form before it goes into my db thus: ... <dtml-var project_title capitalize>,
Try:
<dtml-sqlvar expr="project_title.capitalize()" column=project_title type=string>
Dieter
No this gives : with or without quotes around column=."....." Invalid attribute name, "column", for tag <dtml-sqlvar expr="project_title.capitalize()" column="project_title" type="string">, on line 4 of <string> Marie Marie Robichon Web Task Force European Synchrotron Radiation Facility BP 220 38043 Grenoble Cedex France http://www.esrf.fr Tel: (33) 04 76 88 21 86 Fax: (33) 04 76 88 24 27
I think Dieter introduced a bit of syntatic confusion with nothing to do with capitalization. The problems with the column attirbut come from the fact that <dtml-sqlvar ... > does not have a column attribute. <dtml-sqltest ...> does. Presumably you are passing into a query something as a parameter that you want to ensure is capitalized in the database. You have the choice of capitalizing it before it is passed to the query or capitalizing it in the query. I presume you have chosen the latter course.B If that is the case, presumably you need to use sql that looks like INSERT INTO sometable VALUES( <dtml-sqlvar expr="project_title.capitalize()">, .... ); I'm pretty sure this will work but have not tested it. On Tue, 10 Jun 2003, Marie Robichon wrote:
At 21:03 06/06/2003 +0200, Dieter Maurer wrote:
Marie Robichon wrote at 2003-6-6 17:00 +0200:
... I would like to capitalize an entry of a form before it goes into my db thus: ... <dtml-var project_title capitalize>,
Try:
<dtml-sqlvar expr="project_title.capitalize()" column=project_title type=string>
Dieter
No this gives :
with or without quotes around column=."....."
Invalid attribute name, "column", for tag <dtml-sqlvar expr="project_title.capitalize()" column="project_title" type="string">, on line 4 of <string>
Marie Marie Robichon
Web Task Force European Synchrotron Radiation Facility BP 220 38043 Grenoble Cedex France
Tel: (33) 04 76 88 21 86 Fax: (33) 04 76 88 24 27
_______________________________________________ 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 )
participants (4)
-
Dennis Allison -
Dieter Maurer -
Marie Robichon -
Phil Harris