Re: [web2py] update_or_insert error

2014-12-01 Thread Johann Spies
On 28 November 2014 at 07:26, T.R.Rajkumar  wrote:

> When I do update_or_insert into a table in postgresql I get the following
> error. My code is below.
>  ('ERROR', '42601',
> 'syntax error at or near "<"')
>
What does the  generated query look like?

Regards
Johann

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] update_or_insert error

2014-11-27 Thread T.R.Rajkumar
When I do update_or_insert into a table in postgresql I get the following 
error. My code is below.
 ('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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.