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
e2d99179
Commit
e2d99179
authored
Jan 22, 2003
by
hf@deer.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCRUM
DEFAULT in SELECT & UPDATE corrections
parent
87681bb8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
mysql-test/r/replace.result
mysql-test/r/replace.result
+4
-2
mysql-test/t/replace.test
mysql-test/t/replace.test
+3
-2
sql/item.cc
sql/item.cc
+2
-1
sql/item.h
sql/item.h
+3
-8
No files found.
mysql-test/r/replace.result
View file @
e2d99179
...
...
@@ -12,15 +12,17 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 type=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20));
insert into t1 values (126,"first"),(0,"last");
create table t1 (a tinyint not null auto_increment primary key, b char(20)
default "default_value"
);
insert into t1 values (126,"first"),(
63, "middle"),(
0,"last");
insert into t1 values (0,"error");
Duplicate entry '127' for key 1
replace into t1 values (0,"error");
Duplicate entry '127' for key 1
replace into t1 values (126,"first updated");
replace into t1 values (63,default);
select * from t1;
a b
126 first updated
63 default_value
127 last
drop table t1;
mysql-test/t/replace.test
View file @
e2d99179
...
...
@@ -27,12 +27,13 @@ drop table t1;
# Test when using replace on a key that has used up it's whole range
#
create
table
t1
(
a
tinyint
not
null
auto_increment
primary
key
,
b
char
(
20
));
insert
into
t1
values
(
126
,
"first"
),(
0
,
"last"
);
create
table
t1
(
a
tinyint
not
null
auto_increment
primary
key
,
b
char
(
20
)
default
"default_value"
);
insert
into
t1
values
(
126
,
"first"
),(
63
,
"middle"
),(
0
,
"last"
);
--
error
1062
insert
into
t1
values
(
0
,
"error"
);
--
error
1062
replace
into
t1
values
(
0
,
"error"
);
replace
into
t1
values
(
126
,
"first updated"
);
replace
into
t1
values
(
63
,
default
);
select
*
from
t1
;
drop
table
t1
;
sql/item.cc
View file @
e2d99179
...
...
@@ -1128,7 +1128,7 @@ bool Item_ref::check_loop(uint id)
bool
Item_default_value
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
return
item
->
type
()
==
DEFAULT_ITEM
&&
return
item
->
type
()
==
DEFAULT_
VALUE_
ITEM
&&
((
Item_default_value
*
)
item
)
->
arg
->
eq
(
arg
,
binary_cmp
);
}
...
...
@@ -1167,6 +1167,7 @@ void Item_default_value::print(String *str)
if
(
!
arg
)
{
str
->
append
(
"DEFAULT"
);
return
;
}
str
->
append
(
"DEFAULT("
);
arg
->
print
(
str
);
...
...
sql/item.h
View file @
e2d99179
...
...
@@ -33,7 +33,7 @@ public:
enum
Type
{
FIELD_ITEM
,
FUNC_ITEM
,
SUM_FUNC_ITEM
,
STRING_ITEM
,
INT_ITEM
,
REAL_ITEM
,
NULL_ITEM
,
VARBIN_ITEM
,
COPY_STR_ITEM
,
FIELD_AVG_ITEM
,
DEFAULT_ITEM
,
COPY_STR_ITEM
,
FIELD_AVG_ITEM
,
DEFAULT_
VALUE_
ITEM
,
PROC_ITEM
,
COND_ITEM
,
REF_ITEM
,
FIELD_STD_ITEM
,
FIELD_VARIANCE_ITEM
,
CONST_ITEM
,
SUBSELECT_ITEM
,
ROW_ITEM
,
CACHE_ITEM
};
...
...
@@ -663,7 +663,7 @@ public:
Item_field
((
const
char
*
)
NULL
,
(
const
char
*
)
NULL
,
(
const
char
*
)
NULL
),
arg
(
NULL
)
{}
Item_default_value
(
Item
*
a
)
:
Item_field
((
const
char
*
)
NULL
,
(
const
char
*
)
NULL
,
(
const
char
*
)
NULL
),
arg
(
a
)
{}
enum
Type
type
()
const
{
return
DEFAULT_ITEM
;
}
enum
Type
type
()
const
{
return
DEFAULT_
VALUE_
ITEM
;
}
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
);
bool
check_loop
(
uint
id
)
...
...
@@ -682,12 +682,7 @@ public:
}
return
Item_field
::
save_in_field
(
field
,
no_conversions
);
}
table_map
used_tables
()
const
{
if
(
!
arg
)
return
(
table_map
)
0L
;
return
Item_field
::
used_tables
();
}
table_map
used_tables
()
const
{
return
(
table_map
)
0L
;
}
};
class
Item_cache
:
public
Item
...
...
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