5 type insert_kind
= Values
| Assign
[@@deriving show
{with_path
=false}]
7 (** inferred inserted values to complete sql statement *)
8 type inferred
= (insert_kind
* Sql.Schema.t
) option [@@deriving show
]
10 (** possible number of rows in query result *)
11 type cardinality
= [`Zero_one
| `One
| `Nat
] [@@deriving show
]
13 let cardinality_to_string = show_cardinality
15 type kind
= | Select
of cardinality
16 | Insert
of inferred
* Sql.table_name
17 | Create
of Sql.table_name
18 | CreateIndex
of string
19 | Update
of Sql.table_name
option (** name for single-table UPDATEs *)
20 | Delete
of Sql.table_name list
21 | Alter
of Sql.table_name list
22 | Drop
of Sql.table_name
23 | CreateRoutine
of string
25 [@@deriving show
{with_path
=false}]
27 type category
= DDL
| DQL
| DML
| DCL
| TCL
| OTHER
[@@deriving show
{with_path
=false}, enum
]
29 let all_categories = List.init
(max_category
- min_category
) (fun i
-> Option.get
@@ category_of_enum
@@ min_category
+ i
)
31 let category_of_stmt_kind = function