Forum account registration has been disabled for now due to large spammer volume. Please email me if you would like an account on the forum to chat with others or to set up a sync subscription.
Offline editing of database
  • Hi,

    Is it possible to make a backup of database, download it to a computer, populate it with several favorite entries and later restore it to the application?

    I have a table of food/points on a excel file, and I think that importing it will be easier than input each entry manually on the smartphone :)

    Cheers
    Daniel
  • ddumontddumont
    Administrator
    Yes!

    Though you have to do it with an editor that can edit sqlite (version 3) databases.
    You can make a backup from within the program, edit the file on your sdcard, and then restore the backup from within the program. That should be it!
  • I'll let you know the results ;)
  • One question: what is the DB encoding? Unicode, UTF-8 or ISO-8859-1?
  • ddumontddumont
    Administrator
    Try UTF-8, let me know how it goes....
  • Ok, no good :(

    I downloaded the com.canofsleep.wwdiary.database from /mnt/sdcard/com.canofsleep.wwdiary to my machine and handled the file using the sqlitebrowser.sf.net

    I had to figure out the content of some fields, but I came with several INSERT statements like the ones below:

    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"McDonald's - Big Mac , 1 und", 0, 0, 0, 0, 12);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"McDonald's - Big Tasty , 1 und", 0, 0, 0, 0, 20);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"McDonald's - Casquinha , 1 und", 0, 0, 0, 0, 5);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"McDonald's - Cheddar McMelt , 1 und", 0, 0, 0, 0, 12);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Pão de hambúrguer, 1 und", 0, 0, 0, 0, 3);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Pão de hot-dog, 1 und", 0, 0, 0, 0, 3);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Uva passa, 1/4 xic ", 0, 1, 0, 0, 2);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Vaca atolada (costela, mandica e arroz), 1 und + 1 xic + 1/2 xic", 0, 0, 0, 0, 15);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Vagem, 1 xic", 0, 1, 0, 0, 0);

    The populated database is at http://dl.dropbox.com/u/186528/com.canofsleep.wwdiary.database.offline

    Later, I copied the file back to /mnt/sdcard/com.canofsleep.wwdiary, renaming it to com.canofsleep.wwdiary.database and performed a restore using Menu > Setting > Restore Database. Exited WWDiary and reloaded it.

    There was no way to make the items to appear on the "Food item" field during the food entry operation. Other items that I had manually inserted using the application appears as an autocomplete option.

    I performed another backup of database to see if there is any change on it (available at http://dl.dropbox.com/u/186528/com.canofsleep.wwdiary.database), but the descriptions table is empty: only two entries, with autoincrement key appearing correct...

    Any idea on what I did wrong?

    Cheers
  • ddumontddumont
    Administrator
    So if you restored your database and then clicked on add food or the favorites screen then it would have auto deleted orphaned descriptions.

    This happens to remove clutter like misnamed descriptions when you remove the food from your point log. So if you are adding descriptions like this, make a entry in the pointlog on a date like 0 or something that you'll remember to go manage them from if you need to.
  • Oh YES! :)

    It worked like a charm! I modified the SQL statement to something like

    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Abacate, 4 C.S.", 0, 1, 0, 0, 1); INSERT INTO pointlog (date, desc, points) VALUES (0, (select max(_id) from descriptions), 0);
    INSERT INTO descriptions (type, desc, waterps, veggieps, dairyps, oilps, pps) VALUES (2,"Abacaxi em calda, 1/2 xic", 0, 1, 0, 0, 2); INSERT INTO pointlog (date, desc, points) VALUES (0, (select max(_id) from descriptions), 0);

    Some SQL-guru may have a better solution, but the one above worked for me. Now I have a list of 600 food-types to use!

    Cheers
  • dclobato, could you send me your db? I have seen that you have itens in Portuguese, so I guess it would be usefull for me... thanks
  • OK, I copied this to /mnt/sdcard/com.canofsleep.wwdiary.database
    When I entered WWDiary, the favorites appear empty... What am I missing?
  • There are no favorites no the DB, only the entries. You have to create a new entry on pointlog and type the begining of the name of the item. After you have one entry on your pointlog, you can make it a favorite.
  • Ops, now I could understand how it works!!! Thank you so much, it is working perfectly!
  • so you speak portuguese? :)
  • yes I am from Rio de Janeiro :-)
  • ddumontddumont
    Administrator
    Oh excellent! :D I'm glad you guys could get something working!
  • please tell me a simple way to edit my personal points list. I just signed up for a subscription and can not find how to add food on the site. Am I only able to add foods on my phone and view them on the web.
  • ddumontddumont
    Administrator
    I'm still working on the ability to add food tiems on the website. It's required a large rewrite of some of the app code.

    Editing points can be done by longpressing an entry in the food log.

    If you are a techy, then you could try to edit the sqlite database backup and then restore it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Tagged