• trying to get started with a simple json-db

    From Garth Grudge@GRUDGEDU to All on Saturday, February 22, 2014 13:55:58
    Hi everyone, I decided to post my question in doveNET because my question is somewhat general and maybe could be of use to people at a later date. Basically, I'm just trying to get acquainted with setting up a basic DB to hold some user values with the user number acting as the index or primary key.

    I've got a couple js files that create json-db's, such as synchronetris or uberblox, however, after browsing the code, I couldn't find any reference to the creation of the db. I've noticed if you add a DB service in the services.ini it does not actually create the database at that point after checking the directories. Anyhow, if there's a point in the code or a dependency I'm not looking at, I'm willing to investigate that rather than rely on doveNET for the answer, but should doveNET be so kind as to provide a little code to get me started, here's what I'd like to be able to do without being overly complex :

    1. Create a test json-db
    2. Write a value to the db using USERID number as an index value
    3. Retrieve that value from the DB

    Out of these 3, #1 is obviously the most important. I think I can figure out how to work with the DB once it exists as I've read up on JSON schema and read over json-db at least once(and will probably do a couple more times).

    Thanks for any help in advance,
    grudge

    ---
    ■ Synchronet ■ \1yF\1mU\1cT\1wU\1rR\1gELand : \1w find us through www.grudgemirror.com or grudg
  • From MCMLXXIX@MDJ to Garth Grudge on Sunday, February 23, 2014 23:20:08
    Re: trying to get started with a simple json-db
    By: Garth Grudge to All on Sat Feb 22 2014 13:55:58

    I've got a couple js files that create json-db's, such as synchronetris or uberblox, however, after browsing the code, I couldn't find any reference to the creation of the db. I've noticed if you add a DB service in the services.ini it does not actually create the database at that point after checking the directories. Anyhow, if there's a point in the code or a

    the only time the database deals with files is when loading a backup from file, or storing an intermittent backup to file. the rest of the time, the data is stored in an object. dont rely on the existence of files (that would, in your case, be empty) because they dont exist until there's data to be saved. if you monitor your logs you should see where it creates the database instance.

    ---
    ■ Synchronet ■ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)
  • From Garth Grudge@GRUDGEDU to MCMLXXIX on Monday, February 24, 2014 00:01:56
    Re: trying to get started with a simple json-db
    By: MCMLXXIX to Garth Grudge on Sun Feb 23 2014 11:20 pm

    cool. muchas thanks for the info, i'll keep a lookout for it in the log files once i get some code constructed. it looks like i need to basically :

    1. create a json service is json-service.ini
    2. declare a jsonclient object to connect to that service
    3. declare a json-db that uses that client
    4. learn how to use jsondb so that i can create some goodness

    awesomesauce

    ---
    ■ Synchronet ■ \1yF\1mU\1cT\1wU\1rR\1gELand : \1w find us through www.grudgemirror.com or grudg