mariadb/libmysqld
Iqbal Hassan cb5070c052 MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY
in stored routines

This patch adds support for associative arrays in stored procedures
for sql_mode=ORACLE.
The syntax follows Oracle's PL/SQL syntax for associative arrays -
TYPE assoc_array_t IS TABLE OF VARCHAR2(100) INDEX BY INTEGER;
or
TYPE assoc_array_t IS TABLE OF record_t INDEX BY VARCHAR2(100);
where record_t is a record type.

The following functions were added for associative arrays:
- COUNT - Retrieve the number of elements within the arra
- EXISTS - Check whether given key exists in the array
- FIRST - Retrieve the first key in the array
- LAST - Retrieve the last key in the array
- PRIOR - Retrieve the key before the given key
- NEXT - Retrieve the key after the given key
- DELETE - Remove the element with the given key or remove all elements
if no key is given

The arrays/elements can be initialized with the following methods:
- Constructor
i.e. array:= assoc_array_t('key1'=>1, 'key2'=>2, 'key3'=>3)
- Assignment
i.e. array(key):= record_t(1, 2)
- SELECT INTO
i.e. SELECT x INTO array(key)

TODOs:
- Nested tables are not supported yet.
i.e. TYPE assoc_array_t IS TABLE OF other_assoc_array_t INDEX BY INTEGER;
- Associative arrays comparisons are not supported yet.
2025-05-13 15:32:35 +08:00
..
examples Fix remaining typos 2025-04-29 11:18:00 +10:00
client_settings.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
CMakeLists.txt MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY 2025-05-13 15:32:35 +08:00
emb_qcache.cc cleanup: remove unconditional #ifdef's 2024-11-05 14:00:47 -08:00
emb_qcache.h MDEV-19275 Provide SQL service to plugins. 2020-08-14 21:04:25 +04:00
embedded_priv.h Fixed crash in connect.misc with embedded server 2024-02-27 14:55:47 +02:00
lib_sql.cc Fixed memory leaks in embedded server and mysqltest 2024-04-05 12:40:49 +02:00
libmysql.c Fix typos in C comments in miscellaneous files 2025-03-24 13:36:28 +11:00
libmysqld.c Fixed crash in connect.misc with embedded server 2024-02-27 14:55:47 +02:00
libmysqld.def merge with 5.3 2011-10-19 21:45:18 +02:00
libmysqld.rc query_id and my_xid -> ulonglong 2005-01-27 22:38:56 +01:00
resource.h query_id and my_xid -> ulonglong 2005-01-27 22:38:56 +01:00