ZDB - JSON Database Node server (2020)

Specification:
  • Made on Node for website data and videogames data (scores, etc.).
  • The JSON data is stored on text mode.
    Example:
    File scores.zdb


    Usage:
  • Run index.js to start the server.
  • Test the server at http://localhost:1963/?command=help()
  • Test the server with Squirrel command line here: Squirrel. If server is down, email zarsoft(c)clix.pt
  • Use it on your applications calling http://localhost:1963/?command=help()


    	
    Commands                                        Example
    -----------------------------------------------------------------------------------------------------------------
    create_database(dbname)                         create_database("pong") 
    show_databases()                                show_databases()
    open_database(dbname)                           open_database("pong") 
    close_database(dbname)                          close_database("pong") 
    drop_database(dbname)                           drop_database("pong") 
    _
    create_table(dbname,tname)                      create_table("pong","scores") 
    create_table(dbname,tname,sort_keys)            create_table("pong","scores", [ {key:"score",format:-6} ] ) 
    create_table(dbname,tname,sort_keys,sort_order) create_table("pong","scores", [ {key:"player",format:9} ], "desc" ) 
    describe_table(dbname,tname)                    describe_table("pong","scores") 
    show_tables(dbname)                             show_tables("pong") 
    _
    insert_into_table(dbname,tname,record)          insert_into_table("pong","scores", {player:"Joe",score:555}) 
    save_table(dbname,tname)                        save_table("pong","scores") 
    _
    sort_table(dbname,tname,field)                  sort_table("pong","scores","player") 
    count_all(dbname,tname)                         count_all("pong","scores") 
    count_where(dbname,tname,where)                 count_where("pong","scores", [ "score", ">", 1000 ] ) 
    sum_all(dbname,tname,field)                     sum_all("pong","scores","score") 
    sum_where(dbname,tname,field,where)             sum_where("pong","scores","score", [ "score", ">", 1000 ] ) 
    _
    delete_first(dbname,tname)                      delete_first("pong","scores") 
    delete_last(dbname,tname)                       delete_last("pong","scores") 
    delete_where(dbname,tname,where)                delete_where("pong","scores",["score","<",500]) 
    _
    find_first(dbname,tname)                        find_first("pong","scores") 
    find_next(dbname,tname)                         find_next("pong","scores") 
    find_first_limit(dbname,tname,limit)            find_first_limit("pong","scores",5) 
    find_next_limit(dbname,tname,limit)             find_next_limit("pong","scores",5) 
    find_last(dbname,tname)                         find_last("pong","scores") 
    find_all(dbname,tname)                          find_all("pong","scores") 
    _
    query_first(dbname,tname,where)                 query_first("pong","scores",["score",">=",1000]) 
    query_next(dbname,tname,where)                  query_next("pong","scores",["score",">=",1000]) 
    query_last(dbname,tname,where)                  query_last("pong","scores",["score",">=",1000]) 
    query_all(dbname,tname,where)                   query_all("pong","scores",["score",">=",1000]) 
    query_first_limit(dbname,tname,where,limit)     query_first_limit("pong","scores",["score",">=",1000]) 
    query_next_limit(dbname,tname,where,limit)      query_next_limit("pong","scores",["score",">=",1000]) 
    _
    update_all(dbname,tname,substitution)           update_all("pong","scores",["score",0]) 
    update_where(dbname,tname,substitution,where)   update_where("pong","scores",["score",0],["score",">=",1000]) 
    -----------------------------------------------------------------------------------------------------------------