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
737bade9
Commit
737bade9
authored
Jul 15, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
parents
97b909d4
4b9c7f83
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
74 deletions
+26
-74
client/mysql.cc
client/mysql.cc
+8
-6
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+2
-2
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+2
-2
sql/item_func.cc
sql/item_func.cc
+12
-43
sql/item_func.h
sql/item_func.h
+1
-20
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
client/mysql.cc
View file @
737bade9
...
@@ -1085,7 +1085,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
...
@@ -1085,7 +1085,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
out
=
line
;
out
=
line
;
}
}
}
}
else
if
(
*
ml_comment
&&
!*
in_string
&&
inchar
==
'*'
&&
*
(
pos
+
1
)
==
'/'
)
else
if
(
*
ml_comment
&&
inchar
==
'*'
&&
*
(
pos
+
1
)
==
'/'
)
{
{
pos
++
;
pos
++
;
*
ml_comment
=
0
;
*
ml_comment
=
0
;
...
@@ -1093,11 +1093,13 @@ static bool add_line(String &buffer,char *line,char *in_string,
...
@@ -1093,11 +1093,13 @@ static bool add_line(String &buffer,char *line,char *in_string,
else
else
{
// Add found char to buffer
{
// Add found char to buffer
if
(
inchar
==
*
in_string
)
if
(
inchar
==
*
in_string
)
*
in_string
=
0
;
*
in_string
=
0
;
else
if
(
!*
in_string
&&
(
inchar
==
'\''
||
inchar
==
'"'
||
inchar
==
'`'
))
else
if
(
!*
ml_comment
)
*
in_string
=
(
char
)
inchar
;
{
if
(
!
(
*
ml_comment
))
if
(
!*
in_string
&&
(
inchar
==
'\''
||
inchar
==
'"'
||
inchar
==
'`'
))
*
out
++
=
(
char
)
inchar
;
*
in_string
=
(
char
)
inchar
;
*
out
++=
(
char
)
inchar
;
}
}
}
}
}
if
(
out
!=
line
||
!
buffer
.
is_empty
())
if
(
out
!=
line
||
!
buffer
.
is_empty
())
...
...
mysql-test/r/func_str.result
View file @
737bade9
...
@@ -297,9 +297,9 @@ select FIELD('b','A' COLLATE latin1_bin,'B');
...
@@ -297,9 +297,9 @@ select FIELD('b','A' COLLATE latin1_bin,'B');
FIELD('b','A' COLLATE latin1_bin,'B')
FIELD('b','A' COLLATE latin1_bin,'B')
0
0
select FIELD(_latin2'b','A','B');
select FIELD(_latin2'b','A','B');
ERROR HY000: Illegal mix of collations
for operation 'field'
Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE)
for operation 'field'
select FIELD('b',_latin2'A','B');
select FIELD('b',_latin2'A','B');
ERROR HY000: Illegal mix of collations
for operation 'field'
Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE)
for operation 'field'
select FIELD('b',_latin2'A','B',1);
select FIELD('b',_latin2'A','B',1);
FIELD('b',_latin2'A','B',1)
FIELD('b',_latin2'A','B',1)
1
1
...
...
mysql-test/t/func_str.test
View file @
737bade9
...
@@ -167,9 +167,9 @@ select FIELD('b','A','B');
...
@@ -167,9 +167,9 @@ select FIELD('b','A','B');
select
FIELD
(
'B'
,
'A'
,
'B'
);
select
FIELD
(
'B'
,
'A'
,
'B'
);
select
FIELD
(
'b'
COLLATE
latin1_bin
,
'A'
,
'B'
);
select
FIELD
(
'b'
COLLATE
latin1_bin
,
'A'
,
'B'
);
select
FIELD
(
'b'
,
'A'
COLLATE
latin1_bin
,
'B'
);
select
FIELD
(
'b'
,
'A'
COLLATE
latin1_bin
,
'B'
);
--
error
126
9
--
error
126
5
select
FIELD
(
_latin2
'b'
,
'A'
,
'B'
);
select
FIELD
(
_latin2
'b'
,
'A'
,
'B'
);
--
error
126
9
--
error
126
5
select
FIELD
(
'b'
,
_latin2
'A'
,
'B'
);
select
FIELD
(
'b'
,
_latin2
'A'
,
'B'
);
select
FIELD
(
'b'
,
_latin2
'A'
,
'B'
,
1
);
select
FIELD
(
'b'
,
_latin2
'A'
,
'B'
,
1
);
...
...
sql/item_func.cc
View file @
737bade9
...
@@ -1170,32 +1170,32 @@ longlong Item_func_field::val_int()
...
@@ -1170,32 +1170,32 @@ longlong Item_func_field::val_int()
if
(
cmp_type
==
STRING_RESULT
)
if
(
cmp_type
==
STRING_RESULT
)
{
{
String
*
field
;
String
*
field
;
if
(
!
(
field
=
item
->
val_str
(
&
value
)))
if
(
!
(
field
=
args
[
0
]
->
val_str
(
&
value
)))
return
0
;
// -1 if null ?
return
0
;
// -1 if null ?
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
{
String
*
tmp_value
=
args
[
i
]
->
val_str
(
&
tmp
);
String
*
tmp_value
=
args
[
i
]
->
val_str
(
&
tmp
);
if
(
tmp_value
&&
field
->
length
()
==
tmp_value
->
length
()
&&
if
(
tmp_value
&&
field
->
length
()
==
tmp_value
->
length
()
&&
!
sortcmp
(
field
,
tmp_value
,
cmp_collation
.
collation
))
!
sortcmp
(
field
,
tmp_value
,
cmp_collation
.
collation
))
return
(
longlong
)
(
i
+
1
);
return
(
longlong
)
(
i
);
}
}
}
}
else
if
(
cmp_type
==
INT_RESULT
)
else
if
(
cmp_type
==
INT_RESULT
)
{
{
longlong
val
=
item
->
val_int
();
longlong
val
=
args
[
0
]
->
val_int
();
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
{
if
(
val
==
args
[
i
]
->
val_int
())
if
(
val
==
args
[
i
]
->
val_int
())
return
(
longlong
)
(
i
+
1
);
return
(
longlong
)
(
i
);
}
}
}
}
else
else
{
{
double
val
=
item
->
val
();
double
val
=
args
[
0
]
->
val
();
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
{
if
(
val
==
args
[
i
]
->
val
())
if
(
val
==
args
[
i
]
->
val
())
return
(
longlong
)
(
i
+
1
);
return
(
longlong
)
(
i
);
}
}
}
}
return
0
;
return
0
;
...
@@ -1204,42 +1204,11 @@ longlong Item_func_field::val_int()
...
@@ -1204,42 +1204,11 @@ longlong Item_func_field::val_int()
void
Item_func_field
::
fix_length_and_dec
()
void
Item_func_field
::
fix_length_and_dec
()
{
{
maybe_null
=
0
;
max_length
=
3
;
maybe_null
=
0
;
max_length
=
3
;
used_tables_cache
|=
item
->
used_tables
();
cmp_type
=
args
[
0
]
->
result_type
();
const_item_cache
&=
item
->
const_item
();
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
with_sum_func
=
with_sum_func
||
item
->
with_sum_func
;
cmp_type
=
item
->
result_type
();
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
cmp_type
=
item_cmp_type
(
cmp_type
,
args
[
i
]
->
result_type
());
cmp_type
=
item_cmp_type
(
cmp_type
,
args
[
i
]
->
result_type
());
if
(
cmp_type
==
STRING_RESULT
)
if
(
cmp_type
==
STRING_RESULT
)
{
agg_arg_collations_for_comparison
(
cmp_collation
,
args
,
arg_count
);
cmp_collation
.
set
(
item
->
collation
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
if
(
cmp_collation
.
aggregate
(
args
[
i
]
->
collation
))
{
my_error
(
ER_CANT_AGGREGATE_NCOLLATIONS
,
MYF
(
0
),
func_name
());
return
;
}
}
}
}
void
Item_func_field
::
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
fields
.
push_front
(
item
);
ref_pointer_array
[
el
]
=
item
;
item
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
item
->
name
);
}
Item_func
::
split_sum_func
(
ref_pointer_array
,
fields
);
}
}
...
...
sql/item_func.h
View file @
737bade9
...
@@ -625,33 +625,14 @@ public:
...
@@ -625,33 +625,14 @@ public:
class
Item_func_field
:
public
Item_int_func
class
Item_func_field
:
public
Item_int_func
{
{
Item
*
item
;
String
value
,
tmp
;
String
value
,
tmp
;
Item_result
cmp_type
;
Item_result
cmp_type
;
DTCollation
cmp_collation
;
DTCollation
cmp_collation
;
public:
public:
Item_func_field
(
Item
*
a
,
List
<
Item
>
&
list
)
:
Item_int_func
(
list
),
item
(
a
)
{}
Item_func_field
(
List
<
Item
>
&
list
)
:
Item_int_func
(
list
)
{}
~
Item_func_field
()
{
delete
item
;
}
longlong
val_int
();
longlong
val_int
();
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
,
Item
**
ref
)
{
return
(
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
update_used_tables
()
{
item
->
update_used_tables
()
;
Item_func
::
update_used_tables
();
used_tables_cache
|=
item
->
used_tables
();
const_item_cache
&=
item
->
const_item
();
}
const
char
*
func_name
()
const
{
return
"field"
;
}
const
char
*
func_name
()
const
{
return
"field"
;
}
void
fix_length_and_dec
();
void
fix_length_and_dec
();
void
set_outer_resolving
()
{
item
->
set_outer_resolving
();
Item_int_func
::
set_outer_resolving
();
}
};
};
...
...
sql/sql_yacc.yy
View file @
737bade9
...
@@ -2427,7 +2427,7 @@ simple_expr:
...
@@ -2427,7 +2427,7 @@ simple_expr:
$$= new Item_func_date_format (new Item_func_from_unixtime($3),$5,0);
$$= new Item_func_date_format (new Item_func_from_unixtime($3),$5,0);
}
}
| FIELD_FUNC '(' expr ',' expr_list ')'
| FIELD_FUNC '(' expr ',' expr_list ')'
{ $
$= new Item_func_field($3,
*$5); }
{ $
5->push_front($3); $$= new Item_func_field(
*$5); }
| GEOMFROMTEXT '(' expr ')'
| GEOMFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3); }
{ $$= new Item_func_geometry_from_text($3); }
| GEOMFROMTEXT '(' expr ',' expr ')'
| GEOMFROMTEXT '(' expr ',' expr ')'
...
...
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