In the error page I find the following in the arguments.
*File F:\trr\web2py\web2py\gluon\dal.py in update_or_insert at line 9380*
code arguments variables
Function argument list
(self=<Table cms_meas_details
(id,meas_id,agt_no,jcod,...,m_content,remarks,update_uid,update_dt,line_no)>,
_key=<Query (((((cms_meas_details.jcod = 'TR001') AND...hift = '1')) AND
(cms_meas_details.line_no = 1))>, **values={'agt_no': '10001', 'jcod':
'TR001', 'line_no': 1, 'loc_of_work': 'test', 'm_breadth': '', 'm_content':
'2.000', 'm_depth': '', 'm_length': '', 'm_no': '1.0', 'm_times': '2.0',
...})
I do not know where to see the generated query. I am a newbie. Thank you
for the interest shown.
On Friday, November 28, 2014 10:56:16 AM UTC+5:30, T.R.Rajkumar wrote:
>
> When I do update_or_insert into a table in postgresql I get the following
> error. My code is below.
> <class 'gluon.contrib.pg8000.errors.ProgrammingError'> ('ERROR', '42601',
> 'syntax error at or near "<"')
>
> if form.process(keepvalues=True,onvalidation=validate_meas).accepted:
> j = 1
> for i in range(1,n+1): #len(l)+1
> if is_number(form.vars['txt%s%s' % (i,9)]):
> db.cms_meas_details.update_or_insert(db(db.
> cms_meas_details.agt_no==session.agt_no) & (db.cms_meas_details.jcod==
> session.jcod) & (db.cms_meas_details.meas_date==session.meas_date) & (db.
> cms_meas_details.shift==session.shift) & (db.cms_meas_details.line_no==j),
> meas_id=m_id,agt_no=session.agt_no,
> jcod=session.jcod,
> meas_date=session.meas_date,
> shift=session.shift,
> loc_of_work=form.vars['txt%s%s' %
> (i,1)],
> m_no=form.vars['txt%s%s' %(i,2)],
> m_times=form.vars['txt%s%s' %(i,3
> )],
> m_length=form.vars['txt%s%s' %(i,
> 4)],
> m_breadth=form.vars['txt%s%s' %(i
> ,5)],
> m_depth=form.vars['txt%s%s' %(i,6
> )],
> mat_code=form.vars['cmbMat%s%s'
> %(1,7)],
> unit_weight=form.vars['txt%s%s'
> %(i,8)],
> m_content=form.vars['txt%s%s' %(i
> ,9)],
> remarks=form.vars['txt%s%s' %(i,
> 10)],
> update_uid="e34789",
> update_dt=request.now,
> line_no=j)
> j = j + 1
>
>
> def is_number(s): # Thanks a1an
> http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python
> try:
> n=str(float(s))
> if n == "nan" or n=="inf" or n=="-inf" : return False
> except ValueError:
> try:
> complex(s) # for complex
> except ValueError:
> return False
> return True
>
> Is this postgressql error? What should I do? How to debug and find what
> is wrong. Pl. help.
>
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.