[Gambas-user] issues updated records in Sqlite3 database using edit()

Lonnie Headley lonnie.headley at ...626...
Sat Sep 10 05:19:16 CEST 2011


I just started using the database component and I can't wrap my head around
how updating entries from my database using db.edit(). I'm using Gambas 3 RC
3 on Ubuntu 11.04 x86.

Here is some code, not an exact excerpt but assume that I have assigned
valid values to each of the values of InputItem and that the entry already
exists in the database. I'm just trying to modify some of the values.


Res = dbconn.edit("items", "itemnumber=&1", InputItem.ItemNumber)   '
inputitem.itemnumber = 4000

Inventory.Begin() 'sqlite3 database

Res!itemnumber = InputItem.ItemNumber ' = integer, 4000
Res!active = InputItem.Active ' = 1
Res!price = InputItem.Price ' = 1000
Res!quantity = InputItem.Quantity ' = 100
Res!description = InputItem.Description ' = "New Entry"

Res.Update()

Inventory.Commit()



So with DB.Debug turned on, this is the output:
sqlite3: 0xa2cd6c8: UPDATE 'items' SET 'description' = 'New Entry' WHERE
itemnumber = 4000

I set a breakpoint and can see that all of the values are good there and not
null. It may be a coincidence but the strings are being updated while the
integers are not with the exception of the itemnumber, which is the primary
key. Any ideas?



More information about the User mailing list