diff options
| author | Marcos Magueta <mmagueta@MacMini.local> | 2024-12-08 12:05:27 -0300 |
|---|---|---|
| committer | Marcos Magueta <mmagueta@MacMini.local> | 2024-12-08 12:05:27 -0300 |
| commit | f43943346e3c6d347b829bbbaeccae5f49327749 (patch) | |
| tree | e1dc5af28e599c64e74affb0c1bc9f8a0132e68d /lib/server.ml | |
| parent | 872fc56a414f8c2a4818463be9e104195a0b6242 (diff) | |
| download | Sakura-f43943346e3c6d347b829bbbaeccae5f49327749.tar.gz Sakura-f43943346e3c6d347b829bbbaeccae5f49327749.zip | |
seq scan initial implementation
Diffstat (limited to 'lib/server.ml')
| -rw-r--r-- | lib/server.ml | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/server.ml b/lib/server.ml index 22bee73..3a6d1fa 100644 --- a/lib/server.ml +++ b/lib/server.ml @@ -22,7 +22,20 @@ let client_read sock maxlen = then Lwt.return acc else _read sock acc in _read sock String.empty - >>= fun _ -> match Relation.write_and_retrieve() with | Ok results -> return results | Error err -> return err + >>= fun _ -> + match Relation.write_and_retrieve () with + | Ok (last_commit::_, locations) -> + begin + let (first_names, last_names) = (Planner.Scan.execute last_commit locations "user/first-name", Planner.Scan.execute last_commit locations "user/last-name") in + let tuples = Planner.Join.execute first_names last_names locations in + let (fname, lname) = List.split tuples in + let relation_result: Relation.Protocol.facts = + [{attribute_name = "user/first-name"; attribute_type = "string"; tuples = List.map Bytes.to_string fname}; + {attribute_name = "user/last-name"; attribute_type = "string"; tuples = List.map Bytes.to_string lname}] in + return @@ Xml.to_string (Relation.Protocol.facts_to_xml_light relation_result) + end + | Ok _ -> return "Unstable" + | Error err -> return err let rec socket_read sock = (* (Int32.of_int (String.length results))) *) |
