Nosql lazarus / 16-Databases ---------------------------------------------------------------------- Packs · 2022-12-04 09:07 How to create nosql database in Lazarus with encrypted ---------------------------------------------------------------------- Чебурашка · 2022-12-04 18:02 Can you be a little more specific? Which DBMS are you referring to? ---------------------------------------------------------------------- Packs · 2022-12-05 01:10 I don't know which DBMS I have to use I want to store everything in json It should be easy to insert,delete,select and json should be compressed ---------------------------------------------------------------------- Bogen85 · 2022-12-05 02:51 I don't see explicitly what you are looking for here: https://wiki.freepascal.org/Databases#Supported_databases On can do NoSQL (Json records) with SQLite. (I've not tried it). And SQLite does does support encryption. Were you doing this in some other language and looking for the same with Lazarus/FPC? ---------------------------------------------------------------------- KodeZwerg · 2022-12-05 03:03 Quote from: Prakash on December 05, 2022, 02:10:07 amI don't know which DBMS I have How about to inform yourself before asking such? Quote from: Bogen85 on December 05, 2022, 03:51:06 amSQLite does does support encryption.You can easy encrypt before adding to table and decrypt on getting content. I mean, possibility exists, that I wanted to say  If it is smart or dumb is written on a different paper ---------------------------------------------------------------------- PierceNg · 2022-12-05 03:10 Quote from: Bogen85 on December 05, 2022, 03:51:06 amOn can do NoSQL (Json records) with SQLite. (I've not tried it). I've stored and queried JSON with SQLite. Works fine. I'd say the use case is when external source data to be stored in database is already JSON and there is no requirement to deconstruct said data like normalization. Otherwise when programming in OO style one will typically use an ORM to go between 'native objects' and RDBMS structures; JSON doesn't need to come into the picture. ---------------------------------------------------------------------- Bogen85 · 2022-12-05 03:17 Quote from: KodeZwerg on December 05, 2022, 04:03:34 amQuote from: Bogen85 on December 05, 2022, 03:51:06 amSQLite does does support encryption.You can easy encrypt before adding to table and decrypt on getting content. I mean, possibility exists, that I wanted to say  If it is smart or dumb is written on a different paper  Heh, yeah, really know what Prakash's expectations are... Encryption... Compression... Seems like what is expected is some sort of "simple???" encrypted/compressed JSON "data-store" back-end... I've used "similar" in python, but won't say they are all that good... (especially compare to some proper DBMS). I only mentioned SQLite because it seems like some "simple???" non server back-end is desired here based on what little information is provided... (yes, should not "guess"...) @Prakash, more details are needed as to your expectations, and if you have been doing this already with some some other languages (if you are trying to match functionality). ---------------------------------------------------------------------- Zvoni · 2022-12-05 08:44 mORMot with MongoDB? https://forum.lazarus.freepascal.org/index.php?topic=36965.0 ---------------------------------------------------------------------- Packs · 2022-12-05 10:20 Thanks Everyone . We have selected sqlcipher(sqllite) for this project . It does database encryption . We can store json inside text field . it is having all json support  . ---------------------------------------------------------------------- Packs · 2022-12-05 10:22 CREATE TABLE "users" (    "id"   INTEGER NOT NULL,    "full_name"   TEXT NOT NULL,    "email"   TEXT NOT NULL,    "created"   DATE NOT NULL,    "phone"   TEXT,    PRIMARY KEY("id") ); insert into users (full_name,email,created, phone) values("packs","abc@gmail.com" , "01-01-2022",json('{"cell":"+491765", "home":"+498973"}')); update users    set phone =(select json_replace(users.phone,'$.cell',200) from users where full_name = 'packs')    where full_name == 'packs'; ---------------------------------------------------------------------- Zvoni · 2022-12-05 10:27 Quote from: Prakash on December 05, 2022, 11:22:05 amCREATE TABLE "users" (    "id"   INTEGER NOT NULL,    "full_name"   TEXT NOT NULL,    "email"   TEXT NOT NULL,    "created"   DATE NOT NULL,    "phone"   TEXT,    PRIMARY KEY("id") ); insert into users (full_name,email,created, phone) values("packs","abc@gmail.com" , "01-01-2022",json('{"cell":"+491765", "home":"+498973"}')); update users    set phone =(select json_replace(users.phone,'$.cell',200) from users where full_name = 'packs')    where full_name == 'packs'; See in red. DON'T Use ISO-Format "YYYY-MM-DD" Quotewhere full_name == 'packs';There is an '=' too much..... Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i UPDATE usersSET phone =json_replace(phone,'$.cell',200)WHERE full_name = 'packs'; No need for the Sub-SELECT ---------------------------------------------------------------------- Packs · 2022-12-05 10:42 THANKS. ---------------------------------------------------------------------- Zvoni · 2022-12-05 10:55 Some suggestions/food for thought: I see the tablename "users" Set the Columns "full_name" and "email" to UNIQUE each (not combined!). Especially since i see that "... WHERE full_name='packs'" That way a "full_name" as well as an "email" can only be entered/used once Next: Why use json at all? This is a "classic" 1:m relation One user can have multiple phone-numbers, but any phone-number can only belong to one user. I'd even think about moving "email" to a child-table, since a user can have multiple email-addresses ---------------------------------------------------------------------- Packs · 2022-12-05 11:28 we want to save unstructured data in our application . which is developed in lazarus. ---------------------------------------------------------------------- Zvoni · 2022-12-05 11:36 Quote from: Prakash on December 05, 2022, 12:28:09 pmwe want to save unstructured data in our application . which is developed in lazarus. OK for the unstructered Data. But it's got nothing to do, if it's written in Lazarus/FPC or in Sanskrit. ---------------------------------------------------------------------- Bogen85 · 2022-12-05 11:43 Quote from: Zvoni on December 05, 2022, 12:36:55 pmQuote from: Prakash on December 05, 2022, 12:28:09 pmwe want to save unstructured data in our application . which is developed in lazarus. OK for the unstructered Data. But this is generally the main point of NoSQL... ---------------------------------------------------------------------- Bogen85 · 2022-12-05 11:45 Quote from: Bogen85 on December 05, 2022, 12:43:13 pmBut this is generally the main point of NoSQL... (unstructured data) I know there is more involved with NoSQL then just that... CRUD and all...