Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7f0f4c58
Commit
7f0f4c58
authored
Apr 21, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
parents
8d683973
ecf7f30b
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
258 additions
and
105 deletions
+258
-105
cmd-line-utils/readline/bind.c
cmd-line-utils/readline/bind.c
+1
-3
cmd-line-utils/readline/callback.c
cmd-line-utils/readline/callback.c
+1
-3
cmd-line-utils/readline/complete.c
cmd-line-utils/readline/complete.c
+1
-3
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/config_readline.h
+30
-0
cmd-line-utils/readline/display.c
cmd-line-utils/readline/display.c
+1
-3
cmd-line-utils/readline/funmap.c
cmd-line-utils/readline/funmap.c
+1
-3
cmd-line-utils/readline/histexpand.c
cmd-line-utils/readline/histexpand.c
+1
-3
cmd-line-utils/readline/histfile.c
cmd-line-utils/readline/histfile.c
+1
-3
cmd-line-utils/readline/history.c
cmd-line-utils/readline/history.c
+1
-3
cmd-line-utils/readline/histsearch.c
cmd-line-utils/readline/histsearch.c
+1
-3
cmd-line-utils/readline/input.c
cmd-line-utils/readline/input.c
+1
-3
cmd-line-utils/readline/isearch.c
cmd-line-utils/readline/isearch.c
+1
-3
cmd-line-utils/readline/keymaps.c
cmd-line-utils/readline/keymaps.c
+1
-3
cmd-line-utils/readline/kill.c
cmd-line-utils/readline/kill.c
+1
-3
cmd-line-utils/readline/macro.c
cmd-line-utils/readline/macro.c
+1
-3
cmd-line-utils/readline/mbutil.c
cmd-line-utils/readline/mbutil.c
+1
-3
cmd-line-utils/readline/misc.c
cmd-line-utils/readline/misc.c
+1
-3
cmd-line-utils/readline/nls.c
cmd-line-utils/readline/nls.c
+1
-3
cmd-line-utils/readline/parens.c
cmd-line-utils/readline/parens.c
+1
-3
cmd-line-utils/readline/readline.c
cmd-line-utils/readline/readline.c
+1
-3
cmd-line-utils/readline/rltty.c
cmd-line-utils/readline/rltty.c
+1
-3
cmd-line-utils/readline/search.c
cmd-line-utils/readline/search.c
+1
-3
cmd-line-utils/readline/shell.c
cmd-line-utils/readline/shell.c
+1
-3
cmd-line-utils/readline/signals.c
cmd-line-utils/readline/signals.c
+1
-3
cmd-line-utils/readline/terminal.c
cmd-line-utils/readline/terminal.c
+1
-3
cmd-line-utils/readline/text.c
cmd-line-utils/readline/text.c
+1
-3
cmd-line-utils/readline/tilde.c
cmd-line-utils/readline/tilde.c
+1
-3
cmd-line-utils/readline/undo.c
cmd-line-utils/readline/undo.c
+1
-3
cmd-line-utils/readline/util.c
cmd-line-utils/readline/util.c
+1
-3
cmd-line-utils/readline/vi_mode.c
cmd-line-utils/readline/vi_mode.c
+1
-3
cmd-line-utils/readline/xmalloc.c
cmd-line-utils/readline/xmalloc.c
+1
-3
libmysql/libmysql.c
libmysql/libmysql.c
+1
-0
mysql-test/r/olap.result
mysql-test/r/olap.result
+13
-0
mysql-test/r/type_timestamp.result
mysql-test/r/type_timestamp.result
+47
-0
mysql-test/t/olap.test
mysql-test/t/olap.test
+13
-0
mysql-test/t/type_timestamp.test
mysql-test/t/type_timestamp.test
+21
-0
ndb/src/ndbapi/TransporterFacade.cpp
ndb/src/ndbapi/TransporterFacade.cpp
+4
-0
sql/mysql_priv.h
sql/mysql_priv.h
+0
-2
sql/sql_insert.cc
sql/sql_insert.cc
+82
-12
sql/sql_select.cc
sql/sql_select.cc
+13
-1
sql/table.h
sql/table.h
+4
-0
No files found.
cmd-line-utils/readline/bind.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
#include <sys/types.h>
...
...
cmd-line-utils/readline/callback.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include "rlconf.h"
...
...
cmd-line-utils/readline/complete.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <fcntl.h>
...
...
cmd-line-utils/readline/config_readline.h
0 → 100644
View file @
7f0f4c58
/*
config-readline.h Maintained by hand. Contains the readline specific
parts from config.h.in in readline 4.3
*/
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
*/
#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
# define TERMIOS_MISSING
#endif
#if defined (STRCOLL_BROKEN)
# undef HAVE_STRCOLL
#endif
#if defined (__STDC__) && defined (HAVE_STDARG_H)
# define PREFER_STDARG
# define USE_VARARGS
#else
# if defined (HAVE_VARARGS_H)
# define PREFER_VARARGS
# define USE_VARARGS
# endif
#endif
cmd-line-utils/readline/display.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/funmap.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#if !defined (BUFSIZ)
#include <stdio.h>
...
...
cmd-line-utils/readline/histexpand.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
...
...
cmd-line-utils/readline/histfile.c
View file @
7f0f4c58
...
...
@@ -25,9 +25,7 @@
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
...
...
cmd-line-utils/readline/history.c
View file @
7f0f4c58
...
...
@@ -25,9 +25,7 @@
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
...
...
cmd-line-utils/readline/histsearch.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
#if defined (HAVE_STDLIB_H)
...
...
cmd-line-utils/readline/input.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <fcntl.h>
...
...
cmd-line-utils/readline/isearch.c
View file @
7f0f4c58
...
...
@@ -26,9 +26,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/keymaps.c
View file @
7f0f4c58
...
...
@@ -20,9 +20,7 @@
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
...
...
cmd-line-utils/readline/kill.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/macro.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/mbutil.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <fcntl.h>
...
...
cmd-line-utils/readline/misc.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
...
...
cmd-line-utils/readline/nls.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/parens.c
View file @
7f0f4c58
...
...
@@ -23,9 +23,7 @@
#include "rlconf.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
#include <sys/types.h>
...
...
cmd-line-utils/readline/readline.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include "posixstat.h"
...
...
cmd-line-utils/readline/rltty.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <signal.h>
...
...
cmd-line-utils/readline/search.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <stdio.h>
...
...
cmd-line-utils/readline/shell.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/signals.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
/* Just for NULL. Yuck. */
#include <sys/types.h>
...
...
cmd-line-utils/readline/terminal.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include "posixstat.h"
...
...
cmd-line-utils/readline/text.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
...
...
cmd-line-utils/readline/tilde.c
View file @
7f0f4c58
...
...
@@ -19,9 +19,7 @@
along with Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
...
...
cmd-line-utils/readline/undo.c
View file @
7f0f4c58
...
...
@@ -22,9 +22,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/util.c
View file @
7f0f4c58
...
...
@@ -21,9 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
#include <fcntl.h>
...
...
cmd-line-utils/readline/vi_mode.c
View file @
7f0f4c58
...
...
@@ -31,9 +31,7 @@
#if defined (VI_MODE)
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "config_readline.h"
#include <sys/types.h>
...
...
cmd-line-utils/readline/xmalloc.c
View file @
7f0f4c58
...
...
@@ -20,9 +20,7 @@
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
#endif
#include "config_readline.h"
#include <stdio.h>
...
...
libmysql/libmysql.c
View file @
7f0f4c58
...
...
@@ -186,6 +186,7 @@ void STDCALL mysql_server_end()
}
else
mysql_thread_end
();
free_charsets
();
mysql_client_init
=
org_my_init_done
=
0
;
}
...
...
mysql-test/r/olap.result
View file @
7f0f4c58
...
...
@@ -392,3 +392,16 @@ SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
a SUM(b)
1 4
DROP TABLE t1;
CREATE TABLE t1 (a int(11) NOT NULL);
INSERT INTO t1 VALUES (1),(2);
SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP;
a m
1 1
2 2
NULL 3
SELECT * FROM ( SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP ) t2;
a m
1 1
2 2
NULL 3
DROP TABLE t1;
mysql-test/r/type_timestamp.result
View file @
7f0f4c58
...
...
@@ -432,3 +432,50 @@ t1 CREATE TABLE "t1" (
)
set sql_mode='';
drop table t1;
create table t1 (a int auto_increment primary key, b int, c timestamp);
insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'),
(2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03');
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 0 2002-02-02 02:02:02
3 0 2003-03-03 03:03:03
update t1 set b = 2, c = c where a = 2;
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 2 2002-02-02 02:02:02
3 0 2003-03-03 03:03:03
insert into t1 (a) values (4);
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 2 2002-02-02 02:02:02
3 0 2003-03-03 03:03:03
4 NULL 2001-09-09 04:46:59
update t1 set c = '2004-04-04 04:04:04' where a = 4;
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 2 2002-02-02 02:02:02
3 0 2003-03-03 03:03:03
4 NULL 2004-04-04 04:04:04
insert into t1 (a) values (3), (5) on duplicate key update b = 3, c = c;
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 2 2002-02-02 02:02:02
3 3 2003-03-03 03:03:03
4 NULL 2004-04-04 04:04:04
5 NULL 2001-09-09 04:46:59
insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
(6, '2006-06-06 06:06:06') on duplicate key update b = 4;
select * from t1;
a b c
1 0 2001-01-01 01:01:01
2 2 2002-02-02 02:02:02
3 3 2003-03-03 03:03:03
4 4 2001-09-09 04:46:59
5 NULL 2001-09-09 04:46:59
6 NULL 2006-06-06 06:06:06
drop table t1;
mysql-test/t/olap.test
View file @
7f0f4c58
...
...
@@ -171,3 +171,16 @@ SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
SELECT
SQL_CALC_FOUND_ROWS
a
,
SUM
(
b
)
FROM
t1
GROUP
BY
a
WITH
ROLLUP
LIMIT
1
;
DROP
TABLE
t1
;
#
# Tests for bug #9681: ROLLUP in subquery for derived table wiht
# a group by field declared as NOT NULL
#
CREATE
TABLE
t1
(
a
int
(
11
)
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
SELECT
a
,
SUM
(
a
)
m
FROM
t1
GROUP
BY
a
WITH
ROLLUP
;
SELECT
*
FROM
(
SELECT
a
,
SUM
(
a
)
m
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
t2
;
DROP
TABLE
t1
;
mysql-test/t/type_timestamp.test
View file @
7f0f4c58
...
...
@@ -298,3 +298,24 @@ show create table t1;
# restore default mode
set
sql_mode
=
''
;
drop
table
t1
;
#
# Bug#7806 - insert on duplicate key and auto-update of timestamp
#
create
table
t1
(
a
int
auto_increment
primary
key
,
b
int
,
c
timestamp
);
insert
into
t1
(
a
,
b
,
c
)
values
(
1
,
0
,
'2001-01-01 01:01:01'
),
(
2
,
0
,
'2002-02-02 02:02:02'
),
(
3
,
0
,
'2003-03-03 03:03:03'
);
select
*
from
t1
;
update
t1
set
b
=
2
,
c
=
c
where
a
=
2
;
select
*
from
t1
;
insert
into
t1
(
a
)
values
(
4
);
select
*
from
t1
;
update
t1
set
c
=
'2004-04-04 04:04:04'
where
a
=
4
;
select
*
from
t1
;
insert
into
t1
(
a
)
values
(
3
),
(
5
)
on
duplicate
key
update
b
=
3
,
c
=
c
;
select
*
from
t1
;
insert
into
t1
(
a
,
c
)
values
(
4
,
'2004-04-04 00:00:00'
),
(
6
,
'2006-06-06 06:06:06'
)
on
duplicate
key
update
b
=
4
;
select
*
from
t1
;
drop
table
t1
;
ndb/src/ndbapi/TransporterFacade.cpp
View file @
7f0f4c58
...
...
@@ -160,6 +160,10 @@ setSignalLog(){
}
else
if
(
tmp
!=
0
){
if
(
strcmp
(
tmp
,
"-"
)
==
0
)
signalLogger
.
setOutputStream
(
stdout
);
#ifndef DBUG_OFF
else
if
(
strcmp
(
tmp
,
"+"
)
==
0
)
signalLogger
.
setOutputStream
(
DBUG_FILE
);
#endif
else
signalLogger
.
setOutputStream
(
fopen
(
tmp
,
"w"
));
apiSignalLog
=
tmp
;
...
...
sql/mysql_priv.h
View file @
7f0f4c58
...
...
@@ -668,8 +668,6 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name);
void
mysql_stmt_free
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_reset
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_get_longdata
(
THD
*
thd
,
char
*
pos
,
ulong
packet_length
);
int
check_insert_fields
(
THD
*
thd
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
ulong
counter
);
/* sql_error.cc */
MYSQL_ERROR
*
push_warning
(
THD
*
thd
,
MYSQL_ERROR
::
enum_warning_level
level
,
uint
code
,
...
...
sql/sql_insert.cc
View file @
7f0f4c58
...
...
@@ -42,15 +42,29 @@ static void unlink_blobs(register TABLE *table);
#define DELAYED_LOG_UPDATE 1
#define DELAYED_LOG_BIN 2
/*
Check if insert fields are correct.
Sets table->timestamp_field_type to TIMESTAMP_NO_AUTO_SET or leaves it
as is, depending on if timestamp should be updated or not.
SYNOPSIS
check_insert_fields()
thd The current thread.
table The table for insert.
fields The insert fields.
values The insert values.
NOTE
Clears TIMESTAMP_AUTO_SET_ON_INSERT from table->timestamp_field_type
or leaves it as is, depending on if timestamp should be updated or
not.
RETURN
0 OK
-1 Error
*/
int
check_insert_fields
(
THD
*
thd
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
ulong
counter
)
static
int
check_insert_fields
(
THD
*
thd
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
)
{
if
(
fields
.
elements
==
0
&&
values
.
elements
!=
0
)
{
...
...
@@ -58,7 +72,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
{
my_printf_error
(
ER_WRONG_VALUE_COUNT_ON_ROW
,
ER
(
ER_WRONG_VALUE_COUNT_ON_ROW
),
MYF
(
0
),
counter
);
MYF
(
0
),
1
);
return
-
1
;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
...
...
@@ -66,7 +80,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
check_grant_all_columns
(
thd
,
INSERT_ACL
,
table
))
return
-
1
;
#endif
table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SE
T
;
(
int
)
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_INSER
T
;
}
else
{
// Part field list
...
...
@@ -74,7 +88,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
{
my_printf_error
(
ER_WRONG_VALUE_COUNT_ON_ROW
,
ER
(
ER_WRONG_VALUE_COUNT_ON_ROW
),
MYF
(
0
),
counter
);
MYF
(
0
),
1
);
return
-
1
;
}
TABLE_LIST
table_list
;
...
...
@@ -96,7 +110,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
}
if
(
table
->
timestamp_field
&&
// Don't set timestamp if used
table
->
timestamp_field
->
query_id
==
thd
->
query_id
)
table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SE
T
;
(
int
)
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_INSER
T
;
}
// For the values we need select_priv
#ifndef NO_EMBEDDED_ACCESS_CHECKS
...
...
@@ -106,6 +120,62 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
}
/*
Check update fields for the timestamp field.
SYNOPSIS
check_update_fields()
thd The current thread.
insert_table_list The insert table list.
table The table for update.
update_fields The update fields.
NOTE
If the update fields include the timestamp field,
remove TIMESTAMP_AUTO_SET_ON_UPDATE from table->timestamp_field_type.
RETURN
0 OK
-1 Error
*/
static
int
check_update_fields
(
THD
*
thd
,
TABLE
*
table
,
TABLE_LIST
*
insert_table_list
,
List
<
Item
>
&
update_fields
)
{
ulong
timestamp_query_id
;
LINT_INIT
(
timestamp_query_id
);
/*
Change the query_id for the timestamp column so that we can
check if this is modified directly.
*/
if
(
table
->
timestamp_field
)
{
timestamp_query_id
=
table
->
timestamp_field
->
query_id
;
table
->
timestamp_field
->
query_id
=
thd
->
query_id
-
1
;
}
/*
Check the fields we are going to modify. This will set the query_id
of all used fields to the threads query_id.
*/
if
(
setup_fields
(
thd
,
0
,
insert_table_list
,
update_fields
,
1
,
0
,
0
))
return
-
1
;
if
(
table
->
timestamp_field
)
{
/* Don't set timestamp column if this is modified. */
if
(
table
->
timestamp_field
->
query_id
==
thd
->
query_id
)
(
int
)
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_UPDATE
;
else
table
->
timestamp_field
->
query_id
=
timestamp_query_id
;
}
return
0
;
}
int
mysql_insert
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
List
<
Item
>
&
fields
,
List
<
List_item
>
&
values_list
,
...
...
@@ -450,11 +520,11 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
if
(
!
table
->
insert_values
)
DBUG_RETURN
(
-
1
);
}
if
((
values
&&
check_insert_fields
(
thd
,
table
,
fields
,
*
values
,
1
))
||
if
((
values
&&
check_insert_fields
(
thd
,
table
,
fields
,
*
values
))
||
setup_tables
(
insert_table_list
)
||
(
values
&&
setup_fields
(
thd
,
0
,
insert_table_list
,
*
values
,
0
,
0
,
0
))
||
(
duplic
==
DUP_UPDATE
&&
(
setup_fields
(
thd
,
0
,
insert_table_list
,
update_fields
,
1
,
0
,
0
)
||
(
check_update_fields
(
thd
,
table
,
insert_table_list
,
update_fields
)
||
setup_fields
(
thd
,
0
,
insert_table_list
,
update_values
,
1
,
0
,
0
))))
DBUG_RETURN
(
-
1
);
if
(
values
&&
find_real_table_in_list
(
table_list
->
next
,
table_list
->
db
,
...
...
@@ -1457,7 +1527,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
DBUG_ENTER
(
"select_insert::prepare"
);
unit
=
u
;
if
(
check_insert_fields
(
thd
,
table
,
*
fields
,
values
,
1
))
if
(
check_insert_fields
(
thd
,
table
,
*
fields
,
values
))
DBUG_RETURN
(
1
);
restore_record
(
table
,
default_values
);
// Get empty record
...
...
sql/sql_select.cc
View file @
7f0f4c58
...
...
@@ -4779,7 +4779,7 @@ static Field* create_tmp_field_from_field(THD *thd, Field* org_field,
item
->
result_field
=
new_field
;
else
new_field
->
field_name
=
name
;
if
(
org_field
->
maybe_null
())
if
(
org_field
->
maybe_null
()
||
(
item
&&
item
->
maybe_null
)
)
new_field
->
flags
&=
~
NOT_NULL_FLAG
;
// Because of outer join
if
(
org_field
->
type
()
==
FIELD_TYPE_VAR_STRING
)
table
->
db_create_options
|=
HA_OPTION_PACK_RECORD
;
...
...
@@ -9199,7 +9199,19 @@ bool JOIN::rollup_init()
for
(
j
=
0
;
j
<
fields_list
.
elements
;
j
++
)
rollup
.
fields
[
i
].
push_back
(
rollup
.
null_items
[
i
]);
}
List_iterator_fast
<
Item
>
it
(
fields_list
);
Item
*
item
;
while
((
item
=
it
++
))
{
ORDER
*
group_tmp
;
for
(
group_tmp
=
group_list
;
group_tmp
;
group_tmp
=
group_tmp
->
next
)
{
if
(
*
group_tmp
->
item
==
item
)
item
->
maybe_null
=
1
;
}
}
return
0
;
}
...
...
sql/table.h
View file @
7f0f4c58
...
...
@@ -60,6 +60,10 @@ typedef struct st_filesort_info
/*
Values in this enum are used to indicate during which operations value
of TIMESTAMP field should be set to current timestamp.
WARNING: The values are used for bit operations. If you change the enum,
you must keep the bitwise relation of the values. For example:
(int) TIMESTAMP_AUTO_SET_ON_BOTH ==
(int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
*/
enum
timestamp_auto_set_type
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment