Interestingly, when simply testing like this:

import sqlite3, sys
sPATH=r'e:\pythonexamples\aivars2.db'
oCon=sqlite3.connect(sPATH)

cur=oCon.cursor()

oCon.execute("""UPDATE rezerve SET latusaldo = ? WHERE gads = ?
""",(6000.0,'2006'))

oCon.commit()


it works. Therefore I am stuck since it looks like there is something
wrong in below function.

Thanks,

Aivars


2008/12/2 aivars <[EMAIL PROTECTED]>:
> Alan,
> Thanks.
>
> Ok I should have been more precise and give more code
> There is what I do:
>
> def starpiba(year, month, day):
>    datumsno=str(year+'-01-01') #beginning of year date
>    datumsuz=str(year+'-'+month+'-'+day) #period end date
>
>    result = (atlikumiBeiguKurss(year, month, day)-
> atlikumiDienasKurss(year, month, day))
>    ##print result
>    oCon=sqlite3.connect(sPATH)
>    if result<=0:
>        print abs(result)
>        oCon.execute("UPDATE rezerve SET latusaldo =? where gads
> =?;",(result, [year]))
>        oCon.commit()
>    else:
>        ##print 'aivars'
>        oCon.execute("UPDATE rezerve SET latusaldo =? where gads
> =?;",(result, [year]))
>
> Please bear in mind I am a noob in Python and I write spaggeti code.
>
> There is a table in my sqlite database called rezerve which shows the
> breakdown of a consolidated reserves item in a consolidated balance
> sheet report (if that says anything to you) by years. For the previous
> years the numbers does not change since they are already reported but
> for the current year it may change month by month until reported.
> Therefore, I wanted to update the numbers for the current year.
>
> The above python function works OK.
>
> Thanks
>
> Aivars
>
>
> 2008/12/2 Alan Gauld <[EMAIL PROTECTED]>:
>>
>> "aivars" <[EMAIL PROTECTED]> wrote
>>
>>> oCon.execute("UPDATE rezerve SET latusaldo =? where gads =?;",(result,
>>> [year]))
>>> oCon.commit()
>>>
>>> it throws me the error:
>>> sqlite3.InterfaceError: error binding parameter 1 probably unsupported
>>> type
>>
>> I assume its the [year] value it objects to.
>> I'm not sure what you expect SQLite to do with a list as a value, it does
>> not support a list type field.
>>
>>> All works OK when using INSERT with the same parameters.
>>
>> Are you sure? You can insert a list into a field?
>>
>>> Maybe I should as this question on sqlite list?
>>
>> Perhaps but I think it is the list parameter that it doesn't like.
>> Unless I misunderstand the syntax.
>>
>> --
>> Alan Gauld
>> Author of the Learn to Program web site
>> http://www.freenetpages.co.uk/hp/alan.gauld
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor@python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to