regex.sim 4.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start

sleep 100
sql connect

$db = testdb
sql drop database if exists $db
sql create database $db
sql use $db

print ======================== regular expression match test
$st_name = st
$ct1_name = ct1
$ct2_name = ct2

sql create table $st_name (ts timestamp, c1b binary(20)) tags(t1b binary(20));
sql create table $ct1_name using $st_name tags('taosdata1')
sql create table $ct2_name using $st_name tags('taosdata2')
sql create table not_match using $st_name tags('NOTMATCH')

sql select tbname from $st_name where tbname match '.*'
if $rows != 3 then
  return -1
endi


sql select tbname from $st_name where tbname match '^ct[[:digit:]]'
if $rows != 2 then
  return -1
endi

sql select tbname from $st_name where tbname nmatch '^ct[[:digit:]]'
if $rows != 1 then
  return -1
endi

sql select tbname from $st_name where tbname match '.*'
if $rows != 3 then
  return -1
endi

sql select tbname from $st_name where tbname nmatch '.*'
if $rows != 0 then
  return -1
endi

sql select tbname from $st_name where t1b match '[[:lower:]]+'
if $rows != 2 then
  return -1
endi

sql select tbname from $st_name where t1b nmatch '[[:lower:]]+'
if $rows != 1 then
  return -1
endi

sql insert into $ct1_name values(now, 'this is engine')
sql insert into $ct2_name values(now, 'this is app egnine')

sql select c1b from $st_name where c1b match 'engine'
if $data00 != @this is engine@ then
  return -1
endi

if $rows != 1 then
  return -1
endi  

sql select c1b from $st_name where c1b nmatch 'engine'
if $data00 != @this is app egnine@ then
  return -1
endi

if $rows != 1 then
  return -1
endi  

sql_error select c1b from $st_name where c1b match e;
sql_error select c1b from $st_name where c1b nmatch e;

sql create table wrong_type(ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 float, c5 double, c6 bool, c7 nchar(20)) tags(t0 tinyint, t1 smallint, t2 int, t3 bigint, t4 float, t5 double, t6 bool, t7 nchar(10))
sql insert into wrong_type_1 using wrong_type tags(1, 2, 3, 4, 5, 6, true, 'notsupport') values(now, 1, 2, 3, 4, 5, 6, false, 'notsupport') 
sql_error select * from wrong_type where ts match '.*'
sql_error select * from wrong_type where ts nmatch '.*'
sql_error select * from wrong_type where c0 match '.*'
sql_error select * from wrong_type where c0 nmatch '.*'
sql_error select * from wrong_type where c1 match '.*'
sql_error select * from wrong_type where c1 nmatch '.*'
sql_error select * from wrong_type where c2 match '.*'
sql_error select * from wrong_type where c2 nmatch '.*'
sql_error select * from wrong_type where c3 match '.*'
sql_error select * from wrong_type where c3 nmatch '.*'
sql_error select * from wrong_type where c4 match '.*'
sql_error select * from wrong_type where c4 nmatch '.*'
sql_error select * from wrong_type where c5 match '.*'
sql_error select * from wrong_type where c5 nmatch '.*'
sql_error select * from wrong_type where c6 match '.*'
sql_error select * from wrong_type where c6 nmatch '.*'
sql_error select * from wrong_type where c7 match '.*'
sql_error select * from wrong_type where c7 nmatch '.*'
sql_error select * from wrong_type where t1 match '.*'
sql_error select * from wrong_type where t1 nmatch '.*'
sql_error select * from wrong_type where t2 match '.*'
sql_error select * from wrong_type where t2 nmatch '.*'
sql_error select * from wrong_type where t3 match '.*'
sql_error select * from wrong_type where t3 nmatch '.*'
sql_error select * from wrong_type where t4 match '.*'
sql_error select * from wrong_type where t4 nmatch '.*'
sql_error select * from wrong_type where t5 match '.*'
sql_error select * from wrong_type where t5 nmatch '.*'
sql_error select * from wrong_type where t6 match '.*'
sql_error select * from wrong_type where t6 nmatch '.*'
sql_error select * from wrong_type where t7 match '.*'
sql_error select * from wrong_type where t7 nmatch '.*'

system sh/exec.sh -n dnode1 -s stop -x SIGINT