Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
I propose to introduce a new operators [pos] and [pos:len] to access elements of string types. Where pos - element index, starting from 0, as in c++ stings. Example:
mysql> CREATE TABLE `test` (
|
`id` int(11) NOT NULL AUTO_INCREMENT, |
`data` varchar(100) NOT NULL, |
PRIMARY KEY (`id`)
|
) ENGINE=InnoDB;
|
|
mysql> INSERT INTO `test` (`id`,`data`) VALUES(0,''); |
mysql> UPDATE `test` SET `data`[5] = 'xxx'; |
|
mysql> SELECT * FROM `test` WHERE `id`=0; |
+-----+----------------------------+
|
| sid | data |
|
+-----+----------------------------+
|
| 0 | ' xxx' |
+-----+----------------------------+
|
|
mysql> UPDATE `test` SET `data`[3] = 'aaa'; |
|
mysql> SELECT * FROM `test` WHERE `id`=0; |
+-----+----------------------------+
|
| sid | data |
|
+-----+----------------------------+
|
| 0 | ' aaaxx' |
+-----+----------------------------+
|
|
mysql> UPDATE `test` SET `data`[3:1] = 'bbbbbb'; |
|
mysql> SELECT * FROM `test` WHERE `id`=0; |
+-----+----------------------------+
|
| sid | data |
|
+-----+----------------------------+
|
| 0 | ' baaxx' |
+-----+----------------------------+
|
|
mysql> SELECT `data`[4:3] FROM `test` WHERE `id`=0; |
+----------------------------+
|
| data |
|
+----------------------------+
|
| 'aax' |
+----------------------------+
|
Attachments
Issue Links
- relates to
-
MDEV-6121 Add support for arrays in tables
- Open
- links to