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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
14b7e7c9
Commit
14b7e7c9
authored
Dec 27, 2001
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
parents
cb25ddd1
aa3bce07
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
1 deletion
+72
-1
Docs/manual.texi
Docs/manual.texi
+5
-0
mysql-test/r/variables.result
mysql-test/r/variables.result
+11
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+13
-0
sql/item_func.cc
sql/item_func.cc
+38
-0
sql/item_func.h
sql/item_func.h
+4
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
Docs/manual.texi
View file @
14b7e7c9
...
...
@@ -46888,6 +46888,11 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.47
@itemize @bullet
@item
Fixed in when using the following construct:
@code{SELECT ... WHERE key=@@var_name OR $key=@@var_name2}
@item
Restrict InnoDB keys to 500 bytes.
@item
InnoDB now supports @code{NULL} in keys.
@item
Fixed shutdown problem on HPUX. (Introduced in 3.23.46)
mysql-test/r/variables.result
View file @
14b7e7c9
...
...
@@ -12,3 +12,14 @@ NULL NULL NULL NULL
5 5 1 4
@t5
1.23456
@min_cid:=min(c_id) @max_cid:=max(c_id)
1 4
c_id c_name c_country
1 Bozo USA
4 Mr. Floppy GB
c_id c_name c_country
1 Bozo USA
4 Mr. Floppy GB
c_id c_name c_country
1 Bozo USA
4 Mr. Floppy GB
mysql-test/t/variables.test
View file @
14b7e7c9
#
# test variables
#
drop
table
if
exists
t1
;
set
@
`test`
=
1
,
@
TEST
=
3
,
@
select
=
2
,
@
t5
=
1.23456
;
select
@
test
,
@
`select`
,
@
TEST
,
@
not_used
;
set
@
test_int
=
10
,
@
test_double
=
1
e
-
10
,
@
test_string
=
"abcdeghi"
,
@
test_string2
=
"abcdefghij"
,
@
select
=
NULL
;
...
...
@@ -14,3 +15,15 @@ select @test_int,@test_double,@test_string,@test_string2;
select
@
t1
:=
(
@
t2
:=
1
)
+@
t3
:=
4
,
@
t1
,
@
t2
,
@
t3
;
select
@
t5
;
#
# Test problem with WHERE and variables
#
CREATE
TABLE
t1
(
c_id
INT
(
4
)
NOT
NULL
,
c_name
CHAR
(
20
),
c_country
CHAR
(
3
),
PRIMARY
KEY
(
c_id
));
INSERT
INTO
t1
VALUES
(
1
,
'Bozo'
,
'USA'
),(
2
,
'Ronald'
,
'USA'
),(
3
,
'Kinko'
,
'IRE'
),(
4
,
'Mr. Floppy'
,
'GB'
);
SELECT
@
min_cid
:=
min
(
c_id
),
@
max_cid
:=
max
(
c_id
)
from
t1
;
SELECT
*
FROM
t1
WHERE
c_id
=@
min_cid
OR
c_id
=@
max_cid
;
SELECT
*
FROM
t1
WHERE
c_id
=@
min_cid
OR
c_id
=@
max_cid
OR
c_id
=
666
;
ALTER
TABLE
t1
DROP
PRIMARY
KEY
;
select
*
from
t1
where
c_id
=@
min_cid
OR
c_id
=@
max_cid
;
drop
table
t1
;
sql/item_func.cc
View file @
14b7e7c9
...
...
@@ -1772,6 +1772,16 @@ Item_func_set_user_var::val_str(String *str)
}
void
Item_func_set_user_var
::
print
(
String
*
str
)
{
str
->
append
(
'('
);
str
->
append
(
name
.
str
,
name
.
length
);
str
->
append
(
":="
,
2
);
args
[
0
]
->
print
(
str
);
str
->
append
(
')'
);
}
user_var_entry
*
Item_func_get_user_var
::
get_entry
()
{
if
(
!
entry
||
!
entry
->
value
)
...
...
@@ -1864,6 +1874,34 @@ enum Item_result Item_func_get_user_var::result_type() const
return
entry
->
type
;
}
void
Item_func_get_user_var
::
print
(
String
*
str
)
{
str
->
append
(
'@'
);
str
->
append
(
name
.
str
,
name
.
length
);
str
->
append
(
')'
);
}
bool
Item_func_get_user_var
::
eq
(
const
Item
*
item
)
const
{
/* Assume we don't have rtti */
if
(
this
==
item
)
return
1
;
// Same item is same.
/* Check if other type is also a get_user_var() object */
#ifdef FIX_THIS
if
(
item
->
eq
==
&
Item_func_get_user_var
::
eq
)
return
0
;
#else
if
(
item
->
type
()
!=
FUNC_ITEM
||
((
Item_func
*
)
item
)
->
func_name
()
!=
func_name
())
return
0
;
#endif
Item_func_get_user_var
*
other
=
(
Item_func_get_user_var
*
)
item
;
return
(
name
.
length
==
other
->
name
.
length
&&
!
memcmp
(
name
.
str
,
other
->
name
.
str
,
name
.
length
));
}
longlong
Item_func_inet_aton
::
val_int
()
{
uint
byte_result
=
0
;
...
...
sql/item_func.h
View file @
14b7e7c9
...
...
@@ -817,6 +817,7 @@ class Item_func_set_user_var :public Item_func
enum
Item_result
result_type
()
const
{
return
cached_result_type
;
}
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
);
void
fix_length_and_dec
();
void
print
(
String
*
str
);
const
char
*
func_name
()
const
{
return
"set_user_var"
;
}
};
...
...
@@ -835,13 +836,16 @@ class Item_func_get_user_var :public Item_func
longlong
val_int
();
String
*
val_str
(
String
*
str
);
void
fix_length_and_dec
();
void
print
(
String
*
str
);
enum
Item_result
result_type
()
const
;
const
char
*
func_name
()
const
{
return
"get_user_var"
;
}
bool
const_item
()
const
{
return
const_var_flag
;
}
table_map
used_tables
()
const
{
return
const_var_flag
?
0
:
RAND_TABLE_BIT
;
}
bool
eq
(
const
Item
*
item
)
const
;
};
class
Item_func_inet_aton
:
public
Item_int_func
{
public:
...
...
sql/sql_select.cc
View file @
14b7e7c9
...
...
@@ -35,7 +35,7 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF"
,
"ALL"
,
"range"
,
"index"
,
"fulltext"
};
static
bool
make_join_statistics
(
JOIN
*
join
,
TABLE_LIST
*
tables
,
COND
*
conds
,
DYNAMIC_ARRAY
*
keyuse
);
DYNAMIC_ARRAY
*
keyuse
);
static
bool
update_ref_and_keys
(
THD
*
thd
,
DYNAMIC_ARRAY
*
keyuse
,
JOIN_TAB
*
join_tab
,
uint
tables
,
COND
*
conds
,
table_map
table_map
);
...
...
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