hello, I’m newbie about Erlang/Elixir, I found them very cool. I want learn this fantastic toolchain.
I’m a old school coder, I’m using .NET MVC and mainly Delphi (Pascal) for custom web programming.
I have a question, see the below data, I like move to Elixir/Rust/Nif toolchain, however Delphi is fantastic, but about Elixir functional capabilities: how to render a custom table from a sql database, see this code in Delphi/Webbroker:
In the above code I use the HTTP methods routed by webbroker, then with a pair of nested queries I build the html table resulting as the attached image.
The DDL is very basic, just to have a sample.
CREATE TABLE detail_a101addm
(
id
int NOT NULL AUTO_INCREMENT,
larghezza
int DEFAULT NULL,
profondita
int DEFAULT NULL,
prezzo
float DEFAULT NULL,
welove
int DEFAULT ‘0’,
descrizione
varchar(2048) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
3 | 3000 | 1540 | 4965 | 0 | 8 |
---|---|---|---|---|---|
4 | 3000 | 2040 | 5771 | 0 | 8 |
5 | 3000 | 2530 | 6578 | 0 | 8 |
6 | 3000 | 3030 | 7384 | 0 | 8 |
7 | 3000 | 3520 | 8191 | 0 | 8 |
8 | 3000 | 4020 | 9091 | 0 | 8 |
9 | 3000 | 4510 | 9897 | 0 | 8 |
10 | 3000 | 5010 | 10704 | 0 | 8 |
11 | 3000 | 5500 | 11510 | 0 | 8 |
12 | 3000 | 6160 | 12583 | 0 | 8 |
13 | 3500 | 1540 | 5494 | 0 | 8 |
14 | 3500 | 2040 | 6433 | 0 | 8 |
15 | 3500 | 2530 | 7373 | 0 | 8 |
16 | 3500 | 3030 | 8312 | 0 | 8 |
17 | 3500 | 3520 | 9251 | 0 | 8 |
18 | 3500 | 4020 | 10284 | 0 | 8 |
19 | 3500 | 4510 | 11224 | 0 | 8 |
20 | 3500 | 5010 | 12163 | 0 | 8 |
21 | 3500 | 5500 | 13102 | 0 | 8 |
22 | 3500 | 6160 | 14353 | 0 | 8 |
23 | 4000 | 1540 | 5582 | 0 | 8 |
24 | 4000 | 2040 | 6523 | 0 | 8 |
25 | 4000 | 2530 | 7465 | 0 | 8 |
26 | 4000 | 3030 | 8406 | 0 | 8 |
27 | 4000 | 3520 | 9348 | 0 | 8 |
28 | 4000 | 4020 | 10383 | 0 | 8 |
29 | 4000 | 4510 | 11324 | 0 | 8 |
30 | 4000 | 5010 | 12266 | 0 | 8 |
31 | 4000 | 5500 | 13207 | 0 | 8 |
32 | 4000 | 6160 | 14461 | 0 | 8 |
33 | 4500 | 1540 | 5933 | 0 | 8 |
34 | 4500 | 2040 | 6942 | 0 | 8 |
35 | 4500 | 2530 | 7951 | 0 | 8 |
36 | 4500 | 3030 | 8960 | 0 | 8 |
37 | 4500 | 3520 | 9969 | 0 | 8 |
38 | 4500 | 4020 | 11072 | 0 | 8 |
39 | 4500 | 4510 | 12081 | 0 | 8 |
40 | 4500 | 5010 | 13090 | 0 | 8 |
41 | 4500 | 5500 | 14099 | 0 | 8 |
42 | 4500 | 6160 | 16648 | 0 | 9 |
43 | 5000 | 1540 | 6205 | 0 | 8 |
44 | 5000 | 2040 | 7281 | 0 | 8 |
45 | 5000 | 2530 | 8358 | 0 | 8 |
46 | 5000 | 3030 | 9434 | 0 | 8 |
47 | 5000 | 3520 | 10511 | 0 | 8 |
48 | 5000 | 4020 | 11681 | 1 | 8 |
49 | 5000 | 4510 | 12757 | 0 | 8 |
50 | 5000 | 5010 | 13834 | 1 | 8 |
51 | 5000 | 5500 | 16116 | 0 | 9 |
52 | 5000 | 6160 | 17550 | 1 | 9 |
53 | 5500 | 1540 | 6556 | 0 | 8 |
54 | 5500 | 2040 | 7700 | 0 | 8 |
55 | 5500 | 2530 | 8844 | 0 | 8 |
56 | 5500 | 3030 | 9988 | 0 | 8 |
57 | 5500 | 3520 | 11132 | 0 | 8 |
58 | 5500 | 4020 | 12369 | 0 | 8 |
59 | 5500 | 4510 | 13514 | 0 | 8 |
60 | 5500 | 5010 | 15863 | 0 | 9 |
61 | 5500 | 5500 | 17007 | 0 | 9 |
62 | 5500 | 6160 | 18531 | 0 | 9 |
63 | 6000 | 1540 | 6828 | 0 | 8 |
64 | 6000 | 2040 | 8039 | 0 | 8 |
65 | 6000 | 2530 | 9251 | 0 | 8 |
66 | 6000 | 3030 | 10462 | 0 | 8 |
67 | 6000 | 3520 | 11674 | 0 | 8 |
68 | 6000 | 4020 | 12979 | 1 | 8 |
69 | 6000 | 4510 | 15396 | 0 | 9 |
70 | 6000 | 5010 | 16608 | 1 | 9 |
71 | 6000 | 5500 | 17819 | 0 | 9 |
72 | 6000 | 6160 | 19433 | 1 | 9 |
So:
- how to access low level SQL dataset
- how to iterate SQL dataset (we don’t have loops in Elixir)
- how to render/pre-compile a html view (or direct PLUG IO stream) with custom HTML inserts
- how to solve the above task with Elixir/Phoenix?
Thank you,
kind regards,
Roberto Della Pasqua