"Fossies" - the Fresh Open Source Software Archive

Member "mroonga-9.04/mysql-test/mroonga/wrapper/column/generated/virtual/t/add_column.test" (20 May 2019, 1709 Bytes) of package /linux/misc/mroonga-9.04.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright(C) 2017 Naoya Murakami <naoya@createfield.com>
    2 #
    3 # This library is free software; you can redistribute it and/or
    4 # modify it under the terms of the GNU Lesser General Public
    5 # License as published by the Free Software Foundation; either
    6 # version 2.1 of the License, or (at your option) any later version.
    7 #
    8 # This library is distributed in the hope that it will be useful,
    9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11 # Lesser General Public License for more details.
   12 #
   13 # You should have received a copy of the GNU Lesser General Public
   14 # License along with this library; if not, write to the Free Software
   15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   16 
   17 --source ../../../../../include/mroonga/have_innodb.inc
   18 --source ../../../../../include/mroonga/have_version_5_7_or_later.inc
   19 --source ../../../../../include/mroonga/skip_mariadb_10_1_or_earlier.inc
   20 --source ../../../../../include/mroonga/have_mroonga.inc
   21 
   22 --disable_warnings
   23 DROP TABLE IF EXISTS logs;
   24 --enable_warnings
   25 
   26 CREATE TABLE logs (
   27   id INT PRIMARY KEY,
   28   record JSON
   29 ) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"';
   30 
   31 INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}');
   32 
   33 ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL;
   34 
   35 INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}');
   36 INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}');
   37 
   38 SELECT * FROM logs;
   39 
   40 DROP TABLE logs;
   41 
   42 --source ../../../../../include/mroonga/have_mroonga_deinit.inc