Hi,
Answering your questions is very time consuming, so please try to look in the documentation or the code before posting, if possible. Even for yourself, you will gain time J
In that precise case I think that you would find answers in the persist documentation (look the doc in the module itself, or look at the generated doc on Mihini web site: http://download.eclipse.org/mihini/org.eclipse.mihini-incubation-0.9/Docs/Lua_User_API/persist.html)
Once you do t = persist.table.new('test1'), t is a persisted table. So every time you update a key in that table it is persisted.
t = persist.table.new('test1')
t.a = 1
t.b = 2
--reboot
print(t.b) -- will print value 2
Be careful that only the first level of the table is persisted so if you do:
row1 = {a =1, b=2, c=3}
t = persist.table.new('test1')
t.row1 = row1
then
t.row1.a=2 -- will not be persisted. You have to write the first level of the persisted table so in the current case you would have to do
row1.a=2
t.row1=row1
It work but it is not that efficient. Persisted table is more adapted to store flat values.
Regards,
Cuero
From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of satishbaganal iit
Sent: Tuesday, November 25, 2014 3:31 PM
To: mihini-dev@xxxxxxxxxxx
Subject: [mihini-dev] Mihini persist API
i am using the following code create new table and it creating test1.l2b
file and writing these values in that file.
--local t = require 'persist'
local persist = require 'persist'
t = persist.table.new('test1')
local function main()
print("*********************")
print(" Hello persist")
print("*********************")
persist.table.empty(t)
for i=1,2 do
t["key"..i] = "value"..i
end
end
main()
My question is how to update the values with new values like
my old values in file are
key1 = value1 key2 = vaue2 key3 = value3
and i want to update with
key1 = high key2 = low key3 = 1
please guide me how to solve the problem and is persist is related to sqlite3 database.