0

Choose a safe place to store database on TV?

Hi all,

Please help me to answer:

If i implement to create a database like this:

var db = new SQLite();
db.open('userrp.sql');

Where will the database be created on TV?

I ran it in the VWare, and the database was created in /root folder.
If i want to store this database in a safe place, what should i implement with above codes?


Thanks.

J ^ _ ^

by
11 Replies
  • Widgets will not be allowed to write directly to the filesystem. SQLite databases can not be created by Widgets in production environments.

    Please use the currentAppData and currentProfileData stores for your Widget's storage needs, saving stringified JSON if you have to keep objects or arrays of data. Remember that the embedded platforms may not have much writable storage in their filesystems, and flash storage has a limited number of write cycles, so please keep your strings compact.
    0
  • QUOTE (keville @ Jun 24 2009, 10:23 AM) <{POST_SNAPBACK}>
    Widgets will not be allowed to write directly to the filesystem. SQLite databases can not be created by Widgets in production environments.

    Please use the currentAppData and currentProfileData stores for your Widget's storage needs, saving stringified JSON if you have to keep objects or arrays of data. Remember that the embedded platforms may not have much writable storage in their filesystems, and flash storage has a limited number of write cycles, so please keep your strings compact.


    This is the HUGE problem for me now.
    If using currentAppData or currentProfileData, it seems just store my data in a working session (from start widget to end widget, and the data is released until the widget closes).

    What i want is the data is stored and whenever the widget starts, the data is still retrieved.
    I want:

    A user just need inputs username/password in the first time he/she starts my widget.
    And he/she can close the widget, then, he/she starts the widget in the second, third, 4th.... time --> he/she doesn't need re-input username/password .... until he/she logs out.

    Currently, i try to use
    var request = new XMLHttpRequest();
    request.open( "GET", "http://myweb.com", false );
    request.setRequestHeader( "username", "Jerry" );
    request.send();

    to set username

    and retrieve:
    response = request.getAllResponseHeaders();

    But in "response", there isn't the key "username".

    Please help me.


    Many many thanks.

    J ^ _ ^
    0
  • As long as you're not using the "Simulator Reset" in the WDK, information stored in the currentProfileData and currentAppData should persist when the Engine is restarted. Please provide more details about your testing setup if this is the case.
    0
  • QUOTE (keville @ Jun 25 2009, 10:15 AM) <{POST_SNAPBACK}>
    As long as you're not using the "Simulator Reset" in the WDK, information stored in the currentProfileData and currentAppData should persist when the Engine is restarted. Please provide more details about your testing setup if this is the case.


    Hi Keville,

    I'm testing my widget on the TV.

    Currently, i use currentAppData to store my info(username & password to check Authentication).

    But, i have a problem:
    When i turn TV OFF, my info is lost.

    Please help me.
    What i want is saving my info until i choose logout.
    (same as the Profile widget in Framework, just input Yahoo userID & password 1 time until i switch Profile).

    Thank K.

    J ^ _ ^
    0
  • Hi Keville,

    I don't know why i can't use the function platform.currentProfileData.set on my TV.

    var result = platform.currentProfileData.set("myvar", 'MOMNY');

    OR

    var userInfo = {username: 'Jerry', password: 'jerry'};
    var result;
    try {
    result = platform.currentProfileData.set("myinfo", JSON.stringify(userInfo));
    } catch (error) {
    //log
    }

    The variable "result" always returns FALSE.

    Please help me, : ( ( .
    I have a release in the next week. Huhu

    Thanks so much.

    J ^ _ ^
    0
  • For more info...

    I'm using TV Samsung.

    Thanks.
    0
  • Are you calling set() before you turn off the TV? currentAppData is definitely working as otherwise a _lot_ of widgets would be breaking (add a stock symbol in finance and then turn off your TV as proof).

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jul 6 2009, 09:08 AM) <{POST_SNAPBACK}>
    Are you calling set() before you turn off the TV? currentAppData is definitely working as otherwise a _lot_ of widgets would be breaking (add a stock symbol in finance and then turn off your TV as proof).

    -Jeremy


    Hi Jeremy,

    Of course, i call the function set() before i turn off the TV.

    I don't know why i can use platform.currentAppData to set and get information in the simulator, but i can't use it on the TV.

    In the simulator:
    when i use platform.currentAppData.set("myuserInfo", JSON.stringify(userInfo));
    it returns TRUE,

    BUT
    on the TV:

    when i use platform.currentAppData.set("myuserInfo", JSON.stringify(userInfo));
    it always returns FALSE,

    What i want is: the user just input his info 1 time, and another time (after close the widget, turn off the TV...) he doesn't need to input again... until he selects "LOG OUT" in my widget.

    Please help...

    J ^ _ ^
    0
  • If you paid attention to sticky posts in the forum you would know.

    "Important notice for everyone saving data locally in your widget" -- http://developer.yahoo.net/forum/index.php?showtopic=1596

    Apologize if this is comes off poorly, but I don't post "Important notices" just so they can be ignored.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jul 9 2009, 06:26 PM) <{POST_SNAPBACK}>
    If you paid attention to sticky posts in the forum you would know.

    "Important notice for everyone saving data locally in your widget" -- http://developer.yahoo.net/forum/index.php?showtopic=1596

    Apologize if this is comes off poorly, but I don't post "Important notices" just so they can be ignored.

    -Jeremy


    It can work now,....
    wow, thanks Jeremy so much.


    Jerry ^ _ ^
    0
  • QUOTE (Jerry Dang @ Jul 9 2009, 08:01 PM) <{POST_SNAPBACK}>
    It can work now,....
    wow, thanks Jeremy so much.


    You are very welcome!

    -Jeremy
    0

Recent Posts

in General - Yahoo! TV Widgets