mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
Merge mysql.com:/home/jonas/src/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0-ndb
This commit is contained in:
commit
3db6607c8b
6 changed files with 236 additions and 68 deletions
|
@ -888,3 +888,62 @@ SELECT COUNT(DISTINCT a) FROM t1;
|
||||||
COUNT(DISTINCT a)
|
COUNT(DISTINCT a)
|
||||||
2
|
2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int, b int, c int);
|
||||||
|
INSERT INTO t1 (a, b, c) VALUES
|
||||||
|
(1,1,1), (1,1,2), (1,1,3),
|
||||||
|
(1,2,1), (1,2,2), (1,2,3),
|
||||||
|
(1,3,1), (1,3,2), (1,3,3),
|
||||||
|
(2,1,1), (2,1,2), (2,1,3),
|
||||||
|
(2,2,1), (2,2,2), (2,2,3),
|
||||||
|
(2,3,1), (2,3,2), (2,3,3),
|
||||||
|
(3,1,1), (3,1,2), (3,1,3),
|
||||||
|
(3,2,1), (3,2,2), (3,2,3),
|
||||||
|
(3,3,1), (3,3,2), (3,3,3);
|
||||||
|
SELECT b/c as v, a FROM t1 ORDER BY v;
|
||||||
|
v a
|
||||||
|
0.33333 3
|
||||||
|
0.33333 1
|
||||||
|
0.33333 2
|
||||||
|
0.50000 1
|
||||||
|
0.50000 2
|
||||||
|
0.50000 3
|
||||||
|
0.66667 2
|
||||||
|
0.66667 1
|
||||||
|
0.66667 3
|
||||||
|
1.00000 3
|
||||||
|
1.00000 2
|
||||||
|
1.00000 3
|
||||||
|
1.00000 1
|
||||||
|
1.00000 2
|
||||||
|
1.00000 3
|
||||||
|
1.00000 2
|
||||||
|
1.00000 1
|
||||||
|
1.00000 1
|
||||||
|
1.50000 3
|
||||||
|
1.50000 2
|
||||||
|
1.50000 1
|
||||||
|
2.00000 1
|
||||||
|
2.00000 3
|
||||||
|
2.00000 2
|
||||||
|
3.00000 3
|
||||||
|
3.00000 2
|
||||||
|
3.00000 1
|
||||||
|
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
|
||||||
|
v SUM(a)
|
||||||
|
0.33333 6
|
||||||
|
0.50000 6
|
||||||
|
0.66667 6
|
||||||
|
1.00000 18
|
||||||
|
1.50000 6
|
||||||
|
2.00000 6
|
||||||
|
3.00000 6
|
||||||
|
SELECT SUM(a) FROM t1 GROUP BY b/c;
|
||||||
|
SUM(a)
|
||||||
|
6
|
||||||
|
6
|
||||||
|
6
|
||||||
|
18
|
||||||
|
6
|
||||||
|
6
|
||||||
|
6
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
|
@ -601,3 +601,26 @@ INSERT INTO t1 (a) VALUES ("A"), ("a"), ("a "), ("a "),
|
||||||
("B"), ("b"), ("b "), ("b ");
|
("B"), ("b"), ("b "), ("b ");
|
||||||
SELECT COUNT(DISTINCT a) FROM t1;
|
SELECT COUNT(DISTINCT a) FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test for buf #9210: GROUP BY with expression if a decimal type
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int, b int, c int);
|
||||||
|
INSERT INTO t1 (a, b, c) VALUES
|
||||||
|
(1,1,1), (1,1,2), (1,1,3),
|
||||||
|
(1,2,1), (1,2,2), (1,2,3),
|
||||||
|
(1,3,1), (1,3,2), (1,3,3),
|
||||||
|
(2,1,1), (2,1,2), (2,1,3),
|
||||||
|
(2,2,1), (2,2,2), (2,2,3),
|
||||||
|
(2,3,1), (2,3,2), (2,3,3),
|
||||||
|
(3,1,1), (3,1,2), (3,1,3),
|
||||||
|
(3,2,1), (3,2,2), (3,2,3),
|
||||||
|
(3,3,1), (3,3,2), (3,3,3);
|
||||||
|
|
||||||
|
SELECT b/c as v, a FROM t1 ORDER BY v;
|
||||||
|
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
|
||||||
|
SELECT SUM(a) FROM t1 GROUP BY b/c;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
|
@ -9645,10 +9645,10 @@ void Dbacc::execACC_CHECK_SCAN(Signal* signal)
|
||||||
operationRecPtr.i = scanPtr.p->scanFirstQueuedOp;
|
operationRecPtr.i = scanPtr.p->scanFirstQueuedOp;
|
||||||
ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
|
ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
|
||||||
takeOutReadyScanQueue(signal);
|
takeOutReadyScanQueue(signal);
|
||||||
if (operationRecPtr.p->elementIsDisappeared == ZTRUE) {
|
|
||||||
jam();
|
|
||||||
fragrecptr.i = operationRecPtr.p->fragptr;
|
fragrecptr.i = operationRecPtr.p->fragptr;
|
||||||
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
|
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
|
||||||
|
if (operationRecPtr.p->elementIsDisappeared == ZTRUE) {
|
||||||
|
jam();
|
||||||
if (fragrecptr.p->createLcp == ZTRUE) {
|
if (fragrecptr.p->createLcp == ZTRUE) {
|
||||||
if (remainingUndoPages() < ZMIN_UNDO_PAGES_AT_COMMIT) {
|
if (remainingUndoPages() < ZMIN_UNDO_PAGES_AT_COMMIT) {
|
||||||
jam();
|
jam();
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
{
|
{
|
||||||
len= DECIMAL_BUFF_LENGTH;
|
len= DECIMAL_BUFF_LENGTH;
|
||||||
buf= buffer;
|
buf= buffer;
|
||||||
#if !defined(HAVE_purify) && !defined(DBUG_OFF)
|
#if !defined(DBUG_OFF)
|
||||||
/* Set buffer to 'random' value to find wrong buffer usage */
|
/* Set buffer to 'random' value to find wrong buffer usage */
|
||||||
for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
|
for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
|
||||||
buffer[i]= i;
|
buffer[i]= i;
|
||||||
|
|
|
@ -11891,7 +11891,8 @@ calc_group_buffer(JOIN *join,ORDER *group)
|
||||||
join->group= 1;
|
join->group= 1;
|
||||||
for (; group ; group=group->next)
|
for (; group ; group=group->next)
|
||||||
{
|
{
|
||||||
Field *field=(*group->item)->get_tmp_table_field();
|
Item *group_item= *group->item;
|
||||||
|
Field *field= group_item->get_tmp_table_field();
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
if (field->type() == FIELD_TYPE_BLOB)
|
if (field->type() == FIELD_TYPE_BLOB)
|
||||||
|
@ -11901,27 +11902,36 @@ calc_group_buffer(JOIN *join,ORDER *group)
|
||||||
else
|
else
|
||||||
key_length+= field->pack_length();
|
key_length+= field->pack_length();
|
||||||
}
|
}
|
||||||
else if ((*group->item)->result_type() == REAL_RESULT)
|
else
|
||||||
key_length+=sizeof(double);
|
|
||||||
else if ((*group->item)->result_type() == INT_RESULT)
|
|
||||||
key_length+=sizeof(longlong);
|
|
||||||
else if ((*group->item)->result_type() == STRING_RESULT)
|
|
||||||
{
|
{
|
||||||
|
switch (group_item->result_type()) {
|
||||||
|
case REAL_RESULT:
|
||||||
|
key_length+= sizeof(double);
|
||||||
|
break;
|
||||||
|
case INT_RESULT:
|
||||||
|
key_length+= sizeof(longlong);
|
||||||
|
break;
|
||||||
|
case DECIMAL_RESULT:
|
||||||
|
key_length+= my_decimal_get_binary_size(group_item->max_length -
|
||||||
|
(group_item->decimals ? 1 : 0),
|
||||||
|
group_item->decimals);
|
||||||
|
break;
|
||||||
|
case STRING_RESULT:
|
||||||
/*
|
/*
|
||||||
Group strings are taken as varstrings and require an length field.
|
Group strings are taken as varstrings and require an length field.
|
||||||
A field is not yet created by create_tmp_field()
|
A field is not yet created by create_tmp_field()
|
||||||
and the sizes should match up.
|
and the sizes should match up.
|
||||||
*/
|
*/
|
||||||
key_length+= (*group->item)->max_length + HA_KEY_BLOB_LENGTH;
|
key_length+= group_item->max_length + HA_KEY_BLOB_LENGTH;
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
/* This case should never be choosen */
|
/* This case should never be choosen */
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
join->thd->fatal_error();
|
join->thd->fatal_error();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
parts++;
|
parts++;
|
||||||
if ((*group->item)->maybe_null)
|
if (group_item->maybe_null)
|
||||||
null_parts++;
|
null_parts++;
|
||||||
}
|
}
|
||||||
join->tmp_table_param.group_length=key_length+null_parts;
|
join->tmp_table_param.group_length=key_length+null_parts;
|
||||||
|
|
|
@ -2293,7 +2293,9 @@ session_id char(9) NOT NULL, \
|
||||||
"(\"abj\", 1, 2, 3, 2003-08-30), "
|
"(\"abj\", 1, 2, 3, 2003-08-30), "
|
||||||
"(\"abk\", 1, 2, 3, 2003-08-30), "
|
"(\"abk\", 1, 2, 3, 2003-08-30), "
|
||||||
"(\"abl\", 1, 2, 3, 2003-08-30), "
|
"(\"abl\", 1, 2, 3, 2003-08-30), "
|
||||||
"(\"abq\", 1, 2, 3, 2003-08-30), "
|
"(\"abq\", 1, 2, 3, 2003-08-30) ");
|
||||||
|
myquery(rc);
|
||||||
|
rc= mysql_query(mysql, "INSERT INTO test_select VALUES "
|
||||||
"(\"abw\", 1, 2, 3, 2003-08-30), "
|
"(\"abw\", 1, 2, 3, 2003-08-30), "
|
||||||
"(\"abe\", 1, 2, 3, 2003-08-30), "
|
"(\"abe\", 1, 2, 3, 2003-08-30), "
|
||||||
"(\"abr\", 1, 2, 3, 2003-08-30), "
|
"(\"abr\", 1, 2, 3, 2003-08-30), "
|
||||||
|
@ -4165,40 +4167,40 @@ static void test_prepare_ext()
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
sql= (char *)"CREATE TABLE test_prepare_ext\
|
sql= (char *)"CREATE TABLE test_prepare_ext"
|
||||||
(\
|
"("
|
||||||
c1 tinyint, \
|
" c1 tinyint,"
|
||||||
c2 smallint, \
|
" c2 smallint,"
|
||||||
c3 mediumint, \
|
" c3 mediumint,"
|
||||||
c4 int, \
|
" c4 int,"
|
||||||
c5 integer, \
|
" c5 integer,"
|
||||||
c6 bigint, \
|
" c6 bigint,"
|
||||||
c7 float, \
|
" c7 float,"
|
||||||
c8 double, \
|
" c8 double,"
|
||||||
c9 double precision, \
|
" c9 double precision,"
|
||||||
c10 real, \
|
" c10 real,"
|
||||||
c11 decimal(7, 4), \
|
" c11 decimal(7, 4),"
|
||||||
c12 numeric(8, 4), \
|
" c12 numeric(8, 4),"
|
||||||
c13 date, \
|
" c13 date,"
|
||||||
c14 datetime, \
|
" c14 datetime,"
|
||||||
c15 timestamp(14), \
|
" c15 timestamp(14),"
|
||||||
c16 time, \
|
" c16 time,"
|
||||||
c17 year, \
|
" c17 year,"
|
||||||
c18 bit, \
|
" c18 bit,"
|
||||||
c19 bool, \
|
" c19 bool,"
|
||||||
c20 char, \
|
" c20 char,"
|
||||||
c21 char(10), \
|
" c21 char(10),"
|
||||||
c22 varchar(30), \
|
" c22 varchar(30),"
|
||||||
c23 tinyblob, \
|
" c23 tinyblob,"
|
||||||
c24 tinytext, \
|
" c24 tinytext,"
|
||||||
c25 blob, \
|
" c25 blob,"
|
||||||
c26 text, \
|
" c26 text,"
|
||||||
c27 mediumblob, \
|
" c27 mediumblob,"
|
||||||
c28 mediumtext, \
|
" c28 mediumtext,"
|
||||||
c29 longblob, \
|
" c29 longblob,"
|
||||||
c30 longtext, \
|
" c30 longtext,"
|
||||||
c31 enum('one', 'two', 'three'), \
|
" c31 enum('one', 'two', 'three'),"
|
||||||
c32 set('monday', 'tuesday', 'wednesday'))";
|
" c32 set('monday', 'tuesday', 'wednesday'))";
|
||||||
|
|
||||||
rc= mysql_query(mysql, sql);
|
rc= mysql_query(mysql, sql);
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
@ -10782,7 +10784,7 @@ static void test_view()
|
||||||
ulong length = 0L;
|
ulong length = 0L;
|
||||||
long is_null = 0L;
|
long is_null = 0L;
|
||||||
const char *query=
|
const char *query=
|
||||||
"SELECT COUNT(*) FROM v1 WHERE `SERVERNAME`=?";
|
"SELECT COUNT(*) FROM v1 WHERE SERVERNAME=?";
|
||||||
|
|
||||||
myheader("test_view");
|
myheader("test_view");
|
||||||
|
|
||||||
|
@ -10791,13 +10793,38 @@ static void test_view()
|
||||||
|
|
||||||
rc = mysql_query(mysql, "DROP VIEW IF EXISTS v1,t1,t2,t3");
|
rc = mysql_query(mysql, "DROP VIEW IF EXISTS v1,t1,t2,t3");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql,"CREATE TABLE `t1` ( `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `DBINSTANCE` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERGRP`)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
|
rc= mysql_query(mysql,"CREATE TABLE t1 ("
|
||||||
|
" SERVERGRP varchar(20) NOT NULL default '', "
|
||||||
|
" DBINSTANCE varchar(20) NOT NULL default '', "
|
||||||
|
" PRIMARY KEY (SERVERGRP)) "
|
||||||
|
" CHARSET=latin1 collate=latin1_bin");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql,"CREATE TABLE `t2` ( `SERVERNAME` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERNAME`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
|
rc= mysql_query(mysql,"CREATE TABLE t2 ("
|
||||||
|
" SERVERNAME varchar(20) NOT NULL, "
|
||||||
|
" SERVERGRP varchar(20) NOT NULL, "
|
||||||
|
" PRIMARY KEY (SERVERNAME)) "
|
||||||
|
" CHARSET=latin1 COLLATE latin1_bin");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql,"CREATE TABLE `t3` ( `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `TABNAME` varchar(30) character set latin1 collate latin1_bin NOT NULL default '', `MAPSTATE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `ACTSTATE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `LOCAL_NAME` varchar(30) character set latin1 collate latin1_bin NOT NULL default '', `CHG_DATE` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `CHG_TIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `MXUSER` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERGRP`,`TABNAME`,`MAPSTATE`,`ACTSTATE`,`LOCAL_NAME`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
|
rc= mysql_query(mysql,
|
||||||
|
"CREATE TABLE t3 ("
|
||||||
|
" SERVERGRP varchar(20) BINARY NOT NULL, "
|
||||||
|
" TABNAME varchar(30) NOT NULL, MAPSTATE char(1) NOT NULL, "
|
||||||
|
" ACTSTATE char(1) NOT NULL , "
|
||||||
|
" LOCAL_NAME varchar(30) NOT NULL, "
|
||||||
|
" CHG_DATE varchar(8) NOT NULL default '00000000', "
|
||||||
|
" CHG_TIME varchar(6) NOT NULL default '000000', "
|
||||||
|
" MXUSER varchar(12) NOT NULL default '', "
|
||||||
|
" PRIMARY KEY (SERVERGRP, TABNAME, MAPSTATE, ACTSTATE, "
|
||||||
|
" LOCAL_NAME)) CHARSET=latin1 COLLATE latin1_bin");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql,"CREATE VIEW v1 AS select sql_no_cache T0001.SERVERNAME AS `SERVERNAME`,T0003.TABNAME AS `TABNAME`,T0003.LOCAL_NAME AS `LOCAL_NAME`,T0002.DBINSTANCE AS `DBINSTANCE` from t2 T0001 join t1 T0002 join t3 T0003 where ((T0002.SERVERGRP = T0001.SERVERGRP) and (T0002.SERVERGRP = T0003.SERVERGRP) and (T0003.MAPSTATE = _latin1'A') and (T0003.ACTSTATE = _latin1' '))");
|
rc= mysql_query(mysql,"CREATE VIEW v1 AS select sql_no_cache"
|
||||||
|
" T0001.SERVERNAME AS SERVERNAME, T0003.TABNAME AS"
|
||||||
|
" TABNAME,T0003.LOCAL_NAME AS LOCAL_NAME,T0002.DBINSTANCE AS"
|
||||||
|
" DBINSTANCE from t2 T0001 join t1 T0002 join t3 T0003 where"
|
||||||
|
" ((T0002.SERVERGRP = T0001.SERVERGRP) and"
|
||||||
|
" (T0002.SERVERGRP = T0003.SERVERGRP)"
|
||||||
|
" and (T0003.MAPSTATE = _latin1'A') and"
|
||||||
|
" (T0003.ACTSTATE = _latin1' '))");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
|
@ -10878,7 +10905,11 @@ static void test_view_2where()
|
||||||
MYSQL_BIND bind[8];
|
MYSQL_BIND bind[8];
|
||||||
char parms[8][100];
|
char parms[8][100];
|
||||||
ulong length[8];
|
ulong length[8];
|
||||||
const char *query= "SELECT `RELID` ,`REPORT` ,`HANDLE` ,`LOG_GROUP` ,`USERNAME` ,`VARIANT` ,`TYPE` ,`VERSION` ,`ERFDAT` ,`ERFTIME` ,`ERFNAME` ,`AEDAT` ,`AETIME` ,`AENAME` ,`DEPENDVARS` ,`INACTIVE` FROM `V_LTDX` WHERE `MANDT` = ? AND `RELID` = ? AND `REPORT` = ? AND `HANDLE` = ? AND `LOG_GROUP` = ? AND `USERNAME` IN ( ? , ? ) AND `TYPE` = ?";
|
const char *query=
|
||||||
|
"select relid, report, handle, log_group, username, variant, type, "
|
||||||
|
"version, erfdat, erftime, erfname, aedat, aetime, aename, dependvars, "
|
||||||
|
"inactive from V_LTDX where mandt = ? and relid = ? and report = ? and "
|
||||||
|
"handle = ? and log_group = ? and username in ( ? , ? ) and type = ?";
|
||||||
|
|
||||||
myheader("test_view_2where");
|
myheader("test_view_2where");
|
||||||
|
|
||||||
|
@ -10886,9 +10917,38 @@ static void test_view_2where()
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "DROP VIEW IF EXISTS V_LTDX");
|
rc= mysql_query(mysql, "DROP VIEW IF EXISTS V_LTDX");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "CREATE TABLE `LTDX` ( `MANDT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', `RELID` char(2) character set latin1 collate latin1_bin NOT NULL default '', `REPORT` varchar(40) character set latin1 collate latin1_bin NOT NULL default '', `HANDLE` varchar(4) character set latin1 collate latin1_bin NOT NULL default '', `LOG_GROUP` varchar(4) character set latin1 collate latin1_bin NOT NULL default '', `USERNAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `VARIANT` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `TYPE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `SRTF2` int(11) NOT NULL default '0', `VERSION` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `ERFDAT` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `ERFTIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `ERFNAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `AEDAT` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `AETIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `AENAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `DEPENDVARS` varchar(10) character set latin1 collate latin1_bin NOT NULL default '', `INACTIVE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `CLUSTR` smallint(6) NOT NULL default '0', `CLUSTD` blob, PRIMARY KEY (`MANDT`,`RELID`,`REPORT`,`HANDLE`,`LOG_GROUP`,`USERNAME`,`VARIANT`,`TYPE`,`SRTF2`)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
|
rc= mysql_query(mysql,
|
||||||
|
"CREATE TABLE LTDX (MANDT char(3) NOT NULL default '000', "
|
||||||
|
" RELID char(2) NOT NULL, REPORT varchar(40) NOT NULL,"
|
||||||
|
" HANDLE varchar(4) NOT NULL, LOG_GROUP varchar(4) NOT NULL,"
|
||||||
|
" USERNAME varchar(12) NOT NULL,"
|
||||||
|
" VARIANT varchar(12) NOT NULL,"
|
||||||
|
" TYPE char(1) NOT NULL, SRTF2 int(11) NOT NULL,"
|
||||||
|
" VERSION varchar(6) NOT NULL default '000000',"
|
||||||
|
" ERFDAT varchar(8) NOT NULL default '00000000',"
|
||||||
|
" ERFTIME varchar(6) NOT NULL default '000000',"
|
||||||
|
" ERFNAME varchar(12) NOT NULL,"
|
||||||
|
" AEDAT varchar(8) NOT NULL default '00000000',"
|
||||||
|
" AETIME varchar(6) NOT NULL default '000000',"
|
||||||
|
" AENAME varchar(12) NOT NULL,"
|
||||||
|
" DEPENDVARS varchar(10) NOT NULL,"
|
||||||
|
" INACTIVE char(1) NOT NULL, CLUSTR smallint(6) NOT NULL,"
|
||||||
|
" CLUSTD blob,"
|
||||||
|
" PRIMARY KEY (MANDT, RELID, REPORT, HANDLE, LOG_GROUP, "
|
||||||
|
"USERNAME, VARIANT, TYPE, SRTF2))"
|
||||||
|
" CHARSET=latin1 COLLATE latin1_bin");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "CREATE VIEW V_LTDX AS select T0001.MANDT AS `MANDT`,T0001.RELID AS `RELID`,T0001.REPORT AS `REPORT`,T0001.HANDLE AS `HANDLE`,T0001.LOG_GROUP AS `LOG_GROUP`,T0001.USERNAME AS `USERNAME`,T0001.VARIANT AS `VARIANT`,T0001.TYPE AS `TYPE`,T0001.VERSION AS `VERSION`,T0001.ERFDAT AS `ERFDAT`,T0001.ERFTIME AS `ERFTIME`,T0001.ERFNAME AS `ERFNAME`,T0001.AEDAT AS `AEDAT`,T0001.AETIME AS `AETIME`,T0001.AENAME AS `AENAME`,T0001.DEPENDVARS AS `DEPENDVARS`,T0001.INACTIVE AS `INACTIVE` from LTDX T0001 where (T0001.SRTF2 = 0)");
|
rc= mysql_query(mysql,
|
||||||
|
"CREATE VIEW V_LTDX AS select T0001.MANDT AS "
|
||||||
|
" MANDT,T0001.RELID AS RELID,T0001.REPORT AS "
|
||||||
|
" REPORT,T0001.HANDLE AS HANDLE,T0001.LOG_GROUP AS "
|
||||||
|
" LOG_GROUP,T0001.USERNAME AS USERNAME,T0001.VARIANT AS "
|
||||||
|
" VARIANT,T0001.TYPE AS TYPE,T0001.VERSION AS "
|
||||||
|
" VERSION,T0001.ERFDAT AS ERFDAT,T0001.ERFTIME AS "
|
||||||
|
" ERFTIME,T0001.ERFNAME AS ERFNAME,T0001.AEDAT AS "
|
||||||
|
" AEDAT,T0001.AETIME AS AETIME,T0001.AENAME AS "
|
||||||
|
" AENAME,T0001.DEPENDVARS AS DEPENDVARS,T0001.INACTIVE AS "
|
||||||
|
" INACTIVE from LTDX T0001 where (T0001.SRTF2 = 0)");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
for (i=0; i < 8; i++) {
|
for (i=0; i < 8; i++) {
|
||||||
strcpy(parms[i], "1");
|
strcpy(parms[i], "1");
|
||||||
|
@ -11085,9 +11145,26 @@ static void test_view_insert_fields()
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "DROP VIEW IF EXISTS t1, v1");
|
rc= mysql_query(mysql, "DROP VIEW IF EXISTS t1, v1");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "CREATE TABLE t1 ( K1C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K3C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', F1C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', F2I4 int(11) NOT NULL default '0', F3N5 varchar(5) character set latin1 collate latin1_bin NOT NULL default '00000', F4I4 int(11) NOT NULL default '0', F5C8 varchar(8) character set latin1 collate latin1_bin NOT NULL default '', F6N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', F7F8 double NOT NULL default '0', F8F8 double NOT NULL default '0', F9D8 decimal(8,2) NOT NULL default '0.00', PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
|
rc= mysql_query(mysql,
|
||||||
|
"CREATE TABLE t1 (K1C4 varchar(4) NOT NULL,"
|
||||||
|
"K2C4 varchar(4) NOT NULL, K3C4 varchar(4) NOT NULL,"
|
||||||
|
"K4N4 varchar(4) NOT NULL default '0000',"
|
||||||
|
"F1C4 varchar(4) NOT NULL, F2I4 int(11) NOT NULL,"
|
||||||
|
"F3N5 varchar(5) NOT NULL default '00000',"
|
||||||
|
"F4I4 int(11) NOT NULL default '0', F5C8 varchar(8) NOT NULL,"
|
||||||
|
"F6N4 varchar(4) NOT NULL default '0000',"
|
||||||
|
"F7F8 double NOT NULL default '0',"
|
||||||
|
"F8F8 double NOT NULL default '0',"
|
||||||
|
"F9D8 decimal(8,2) NOT NULL default '0.00',"
|
||||||
|
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) "
|
||||||
|
"CHARSET=latin1 COLLATE latin1_bin");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "CREATE VIEW v1 AS select sql_no_cache K1C4 AS `K1C4`,K2C4 AS `K2C4`,K3C4 AS `K3C4`,K4N4 AS `K4N4`,F1C4 AS `F1C4`,F2I4 AS `F2I4`,F3N5 AS `F3N5`,F7F8 AS `F7F8`,F6N4 AS `F6N4`,F5C8 AS `F5C8`,F9D8 AS `F9D8` from t1 T0001");
|
rc= mysql_query(mysql,
|
||||||
|
"CREATE VIEW v1 AS select sql_no_cache "
|
||||||
|
" K1C4 AS K1C4, K2C4 AS K2C4, K3C4 AS K3C4, K4N4 AS K4N4, "
|
||||||
|
" F1C4 AS F1C4, F2I4 AS F2I4, F3N5 AS F3N5,"
|
||||||
|
" F7F8 AS F7F8, F6N4 AS F6N4, F5C8 AS F5C8, F9D8 AS F9D8"
|
||||||
|
" from t1 T0001");
|
||||||
|
|
||||||
for (i= 0; i < 11; i++)
|
for (i= 0; i < 11; i++)
|
||||||
{
|
{
|
||||||
|
@ -12582,7 +12659,6 @@ static void test_bug7990()
|
||||||
|
|
||||||
static void test_view_sp_list_fields()
|
static void test_view_sp_list_fields()
|
||||||
{
|
{
|
||||||
MYSQL_STMT *stmt;
|
|
||||||
int rc;
|
int rc;
|
||||||
MYSQL_RES *res;
|
MYSQL_RES *res;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue