Details

      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'
      +----------------------------+

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              GenryU Genry Uncij added a comment -

              Complete description in MySQL bug tracker: http://bugs.mysql.com/bug.php?id=77346

              Show
              GenryU Genry Uncij added a comment - Complete description in MySQL bug tracker: http://bugs.mysql.com/bug.php?id=77346

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  Mikle Mikle
                • Votes:
                  4 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated: