summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc2
-rw-r--r--client/mysqltest.c2
-rw-r--r--include/mysql.h2
-rw-r--r--libmysql/libmysql.c8
-rw-r--r--libmysqld/lib_sql.cc37
-rw-r--r--mysql-test/r/union.result4
-rw-r--r--mysql-test/t/union.test13
-rw-r--r--sql/sql_union.cc23
8 files changed, 47 insertions, 44 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index bb425ea33b1..6c947d90d76 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -37,7 +37,7 @@
#include <signal.h>
#include <violite.h>
-const char *VER="11.15";
+const char *VER="11.16";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
diff --git a/client/mysqltest.c b/client/mysqltest.c
index beea95720d1..1345f569593 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1934,7 +1934,7 @@ static void init_var_hash()
static const char *embedded_server_args[] = {
"", /* XXX: argv[0] is program name - we should fix the API */
"--datadir=.",
- "--language=/home/tim/my/4/sql/share/english",
+ "--language=/usr/local/mysql/share/mysql/english",
"--skip-innodb",
NullS
};
diff --git a/include/mysql.h b/include/mysql.h
index 7db907fb0f3..3431dc61945 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -224,7 +224,7 @@ typedef struct st_mysql_res {
/* Set up and bring down the server; to ensure that applications will
* work when linked against either the standard client library or the
* embedded server library, these functions should be called. */
-void mysql_server_init(int argc, char **argv, const char **groups);
+void mysql_server_init(int argc, const char **argv, const char **groups);
void mysql_server_end();
/* Set up and bring down a thread; these function should be called
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index cb2407efdd0..eb0e2f1820a 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -92,10 +92,12 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length);
void mysql_server_init(int argc __attribute__((unused)),
- char **argv __attribute__((unused)),
- const char **groups __attribute__((unused))) {}
+ const char **argv __attribute__((unused)),
+ const char **groups __attribute__((unused)))
+{}
-void mysql_server_end() {}
+void mysql_server_end()
+{}
my_bool mysql_thread_init()
{
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 015ca7b7287..f07150c9845 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -203,17 +203,17 @@ check_connections1(THD *thd)
static int
check_connections2(THD * thd)
{
-uint connect_errors=0;
-uint pkt_len = 0;
-NET * net = &thd -> net;
-if (protocol_version>9) net -> return_errno=1;
+ uint connect_errors=0;
+ uint pkt_len = 0;
+ NET * net = &thd -> net;
+ if (protocol_version>9) net -> return_errno=1;
- if ( (pkt_len=my_net_read(net)) == packet_error ||
- pkt_len < MIN_HANDSHAKE_SIZE)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
+ if ( (pkt_len=my_net_read(net)) == packet_error ||
+ pkt_len < MIN_HANDSHAKE_SIZE)
+ {
+ inc_host_errors(&thd->remote.sin_addr);
+ return(ER_HANDSHAKE_ERROR);
+ }
#ifdef _CUSTOMCONFIG_
#include "_cust_sql_parse.h"
@@ -245,15 +245,6 @@ if (protocol_version>9) net -> return_errno=1;
}
-
-
-
-
-
-
-
-
-
static bool check_user(THD *thd,enum_server_command command, const char *user,
const char *passwd, const char *db, bool check_count)
{
@@ -317,7 +308,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
extern "C"{
-void mysql_server_init(int argc, char **argv, const char **groups)
+void mysql_server_init(int argc, const char **argv, const char **groups)
{
char hostname[FN_REFLEN];
@@ -331,19 +322,19 @@ void mysql_server_init(int argc, char **argv, const char **groups)
if (argc)
{
argcp = &argc;
- argvp = &argv;
+ argvp = (char***) &argv;
}
else
{
argcp = &fake_argc;
- argvp = (char ***)&fake_argv;
+ argvp = (char ***) &fake_argv;
}
if (!groups)
groups = fake_groups;
my_umask=0660; // Default umask for new files
my_umask_dir=0700; // Default umask for new directories
- MY_INIT((char *)"mysqld"); // init my_sys library & pthreads
+ MY_INIT((char *)"mysqld_server"); // init my_sys library & pthreads
tzset(); // Set tzname
start_time=time((time_t*) 0);
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index b46a706264f..a0836cf1680 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -62,3 +62,7 @@ t2 ALL NULL NULL NULL NULL 4
pseudo
dekad
joce
+pseudo pseudo1 same
+dekad joce 1
+joce testtt 1
+joce tsestset 1
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index a5f1bfd644d..8325e6c7e77 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -25,15 +25,21 @@ select a,b from t1 into outfile 'skr' union select a,b from t2;
--error 1216
select a,b from t1 order by a union select a,b from t2;
---error 1217
-create table t3 select a,b from t1 union select a from t2;
-
--error 1216
insert into t3 select a from t1 order by a union select a from t2;
--error 1217
+create table t3 select a,b from t1 union select a from t2;
+
+--error 1217
select a,b from t1 union select a from t2;
+--error 1217
+select * from t1 union select a from t2;
+
+--error 1217
+select a from t1 union select * from t2;
+
# Test CREATE, INSERT and REPLACE
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
@@ -54,4 +60,5 @@ CREATE TABLE t1 (
) TYPE=MyISAM;
INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1);
SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce';
+SELECT * FROM t1 WHERE pseudo1='joce' UNION SELECT * FROM t1 WHERE pseudo='joce';
drop table t1;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 5afef6b390d..86ecaba6d3b 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -35,7 +35,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
TMP_TABLE_PARAM tmp_table_param;
select_union *union_result;
int res;
- uint elements;
DBUG_ENTER("mysql_union");
/* Fix tables--to-be-unioned-from list to point at opened tables */
@@ -48,17 +47,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
}
/* Find last select part as it's here ORDER BY and GROUP BY is stored */
- elements= lex->select_lex.item_list.elements;
for (last_sl= &lex->select_lex;
last_sl->next;
- last_sl=last_sl->next)
- {
- if (elements != last_sl->next->item_list.elements)
- {
- my_error(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,MYF(0));
- return -1;
- }
- }
+ last_sl=last_sl->next) ;
if (lex->select_lex.options & SELECT_DESCRIBE)
{
@@ -78,7 +69,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
result);
}
DBUG_RETURN(0);
- }
+ }
order = (ORDER *) last_sl->order_list.first;
{
@@ -93,8 +84,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if (setup_fields(thd,first_table,item_list,0,0,1))
DBUG_RETURN(-1);
}
+
bzero((char*) &tmp_table_param,sizeof(tmp_table_param));
- tmp_table_param.field_count=elements;
+ tmp_table_param.field_count=item_list.elements;
if (!(table=create_tmp_table(thd, &tmp_table_param, item_list,
(ORDER*) 0, !lex->union_option,
1, 0,
@@ -188,8 +180,15 @@ select_union::~select_union()
{
}
+
int select_union::prepare(List<Item> &list)
{
+ if (list.elements != table->fields)
+ {
+ my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
+ ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT),MYF(0));
+ return -1;
+ }
return 0;
}