//. This file is used as both data url and SaveUrl //. Generates data for FastGrid by get() function or saves received changes to database by set() function //. Uses UTF8Store object from UTF8Store.js to create FastGrid JSON data with UTF8Store format // ----------------------------------------------------------------------------------------------------------------------------- //. Reads data from database and returns them in JSON function get(req,res){ var sql = require('better-sqlite3'), db = new sql('SQLite.db'); //. It uses SQLite3 database engine on database in file SQLite.sb var UTF8Store = require("./UTF8Store.js"); try { var rows = db.prepare("SELECT * FROM TableData").all(); } //. Selects the whole table and calls the process function with the results catch(e){ err("SQL select error: "+e.message,res); return; } var s = "FGrid.Data={"; s += "Par:{P:["; //. Defines one par named "P", it will be used the same for all rows. It will code the two row attributes id and U s += "'id',0x1,"; //. id is coded with ucode 0x1 in one char s += "'U',0x2005"; //. The cell values are coded in U in UTF8 Store. The U attribute is coded to Par as raw with ucode 0x2000 + 5 => summary of ucode sizes: [0x3] 1 char + [0xC9] 2 chars + [0x1] 1 char + [0x1] 1 char s += "]},"; s += "Body_Cfg:{Par:'P'},"; //. Assigns the defined par "P" for all rows in Body. The Body definition is now one strings, where every row consists of 6 characters (id = 1 char, U = 5 chars) s += "Body:\""; var Projects = [], Names = [], Surnames = []; for(var i=0;i