You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let number_of_commands_since_block_query block_commands_table =
74
73
(Caqti_type.(t2 string int) ->! Caqti_type.(t4 string int int int))
75
-
{sql|
76
-
WITH RECURSIVE chain AS
77
-
(
78
-
SELECT id, parent_id, chain_status, state_hash, height, global_slot_since_genesis FROM blocks
79
-
WHERE state_hash = ?
80
-
UNION ALL
81
-
SELECT b.id, b.parent_id, b.chain_status, b.state_hash, b.height, b.global_slot_since_genesis FROM blocks b
82
-
INNER JOIN chain ON b.id = chain.parent_id AND (chain.id <> 0 OR b.id = 0)
83
-
) SELECT state_hash, height, global_slot_since_genesis, count(bc.block_id) as user_command_count FROM chain left join blocks_user_commands bc on bc.block_id = id where global_slot_since_genesis >= ? group by state_hash, height, global_slot_since_genesis;
74
+
( chain_of_query
75
+
^ Printf.sprintf
76
+
{sql|
77
+
SELECT
78
+
state_hash,
79
+
height,
80
+
global_slot_since_genesis,
81
+
COUNT(bc.block_id) AS command_count
82
+
FROM chain
83
+
LEFT JOIN %s bc
84
+
ON chain.id = bc.block_id
85
+
WHERE global_slot_since_genesis >= ?
86
+
GROUP BY
87
+
state_hash,
88
+
height,
89
+
global_slot_since_genesis;
84
90
|sql}
91
+
block_commands_table )
85
92
86
93
let number_of_user_commands_since_block (module Conn : CONNECTION)
let number_of_internal_commands_since_block_query =
92
-
(Caqti_type.(t2 string int) ->! Caqti_type.(t4 string int int int))
93
-
{sql|
94
-
WITH RECURSIVE chain AS
95
-
(
96
-
SELECT id, parent_id, chain_status, state_hash, height, global_slot_since_genesis FROM blocks
97
-
WHERE state_hash = ?
98
-
UNION ALL
99
-
SELECT b.id, b.parent_id, b.chain_status, b.state_hash, b.height, b.global_slot_since_genesis FROM blocks b
100
-
INNER JOIN chain ON b.id = chain.parent_id AND (chain.id <> 0 OR b.id = 0)
101
-
) SELECT state_hash, height, global_slot_since_genesis, count(bc.block_id) as internal_command_count FROM chain left join blocks_internal_commands bc on bc.block_id = id where global_slot_since_genesis >= ? group by state_hash, height, global_slot_since_genesis
102
-
;
103
-
|sql}
104
-
105
99
let number_of_internal_commands_since_block (module Conn : CONNECTION)
(Caqti_type.(t2 string int) ->! Caqti_type.(t4 string int int int))
112
-
{sql|
113
-
WITH RECURSIVE chain AS
114
-
(
115
-
SELECT id, parent_id, chain_status, state_hash, height, global_slot_since_genesis FROM blocks
116
-
WHERE state_hash = ?
117
-
UNION ALL
118
-
SELECT b.id, b.parent_id, b.chain_status, b.state_hash, b.height, b.global_slot_since_genesis FROM blocks b
119
-
INNER JOIN chain ON b.id = chain.parent_id AND (chain.id <> 0 OR b.id = 0)
120
-
) SELECT state_hash, height, global_slot_since_genesis, count(bc.block_id) as zkapp_command_count FROM chain left join blocks_zkapp_commands bc on bc.block_id = id where global_slot_since_genesis >= ? group by state_hash, height, global_slot_since_genesis
121
-
;
122
-
|sql}
123
-
124
105
let number_of_zkapps_commands_since_block (module Conn : CONNECTION)
0 commit comments