Android Question Edit KeyValueStore files

postasat

Active Member
Licensed User
Longtime User
I'm searching for a software to edit on windows pc, the file I created with B4A and kvs.

In my code I created a kvs file as follow

B4X:
        kvs1.Initialize(File.DirRootExternal & "/Download/Lesson/" & class_name, new_lesson & ".les")

In kvs file I put a list with 10 item as follow
B4X:
kvs1.PutObject("Item #" & recordsequence, list1)

In the directory Lesson, at the end, the program generate two file as follow:
lesson1.les and lesson1.les.journal
In B4A, with kvs I can open it and extract data very easy,

I need to edit data on windows pc to modify some of them.

I tried to open the file lesson1.les renamed to lesson1.les.db with DBBrowser for SQLite and SQlite_Expert.
I can open the file but I can't see my data and I can't edit my data.

What's wrong ?
How can I edit data ?

Thank you.
Roberto.
 

DonManfred

Expert
Licensed User
Longtime User
the kvs file is a SQLite database.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
like DonManfred explained it is a sqlite DB and contains only one table with 2 fields: key and value, where value is a blob field.
you can use:
B4X:
SELECT hex(value) FROM main
but all you will see is a hex string:confused:
 
Upvote 0

postasat

Active Member
Licensed User
Longtime User
Hi,

I used the new class KeyValueStore v2 with the last library and I generated a Datastore2 file with the example, using this code:
B4X:
    'add a collection
    Dim list1 As List
    list1.Initialize
    For i = 1 To 10
        list1.Add("Item 1" & i)
        list1.Add("Item 2" & i)
        list1.Add("Item 3" & i)
        list1.Add("Item 4" & i)
        list1.Add("Item 5" & i)
        list1.Add("Item 6" & i)
        list1.Add("Item 7" & i)
        kvsStart.kvs.Put("list1" & i, list1)
        list1.clear
    Next
if I try to open the datastore2 file with firefox and sql_manager extension I can see the table, I can see the Key but I can't see the data.
I only see the value BLOB (Size: 60).
Is it possible to edit a datastore2 file with windows pc ?

Thank you.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
you put a list into the datastore, this is a collection type which will be converted into a bytestream. One thing: Your code does insert the list 10 times....why that? you should put the kvsStart.kvs.Put("list1" & i, list1) after the loop....
 
Upvote 0
Top