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
0dd8eb22
Commit
0dd8eb22
authored
Nov 03, 2006
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/home/bar/mysql-5.1.b22823
into mysql.com:/usr/home/bar/mysql-5.1-rpl
parents
76d00075
8a617440
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
8 deletions
+111
-8
mysql-test/r/xml.result
mysql-test/r/xml.result
+73
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+30
-0
sql/item_xmlfunc.cc
sql/item_xmlfunc.cc
+8
-8
No files found.
mysql-test/r/xml.result
View file @
0dd8eb22
...
@@ -736,3 +736,76 @@ test
...
@@ -736,3 +736,76 @@ test
select extractValue('<x.-_:>test</x.-_:>','//*');
select extractValue('<x.-_:>test</x.-_:>','//*');
extractValue('<x.-_:>test</x.-_:>','//*')
extractValue('<x.-_:>test</x.-_:>','//*')
test
test
set @xml= "<entry><id>pt10</id><pt>10</pt></entry><entry><id>pt50</id><pt>50</pt></entry>";
select ExtractValue(@xml, "/entry[(pt=10)]/id");
ExtractValue(@xml, "/entry[(pt=10)]/id")
pt10
select ExtractValue(@xml, "/entry[(pt!=10)]/id");
ExtractValue(@xml, "/entry[(pt!=10)]/id")
pt50
select ExtractValue(@xml, "/entry[(pt<10)]/id");
ExtractValue(@xml, "/entry[(pt<10)]/id")
select ExtractValue(@xml, "/entry[(pt<=10)]/id");
ExtractValue(@xml, "/entry[(pt<=10)]/id")
pt10
select ExtractValue(@xml, "/entry[(pt>10)]/id");
ExtractValue(@xml, "/entry[(pt>10)]/id")
pt50
select ExtractValue(@xml, "/entry[(pt>=10)]/id");
ExtractValue(@xml, "/entry[(pt>=10)]/id")
pt10 pt50
select ExtractValue(@xml, "/entry[(pt=50)]/id");
ExtractValue(@xml, "/entry[(pt=50)]/id")
pt50
select ExtractValue(@xml, "/entry[(pt!=50)]/id");
ExtractValue(@xml, "/entry[(pt!=50)]/id")
pt10
select ExtractValue(@xml, "/entry[(pt<50)]/id");
ExtractValue(@xml, "/entry[(pt<50)]/id")
pt10
select ExtractValue(@xml, "/entry[(pt<=50)]/id");
ExtractValue(@xml, "/entry[(pt<=50)]/id")
pt10 pt50
select ExtractValue(@xml, "/entry[(pt>50)]/id");
ExtractValue(@xml, "/entry[(pt>50)]/id")
select ExtractValue(@xml, "/entry[(pt>=50)]/id");
ExtractValue(@xml, "/entry[(pt>=50)]/id")
pt50
select ExtractValue(@xml, "/entry[(10=pt)]/id");
ExtractValue(@xml, "/entry[(10=pt)]/id")
pt10
select ExtractValue(@xml, "/entry[(10!=pt)]/id");
ExtractValue(@xml, "/entry[(10!=pt)]/id")
pt50
select ExtractValue(@xml, "/entry[(10>pt)]/id");
ExtractValue(@xml, "/entry[(10>pt)]/id")
select ExtractValue(@xml, "/entry[(10>=pt)]/id");
ExtractValue(@xml, "/entry[(10>=pt)]/id")
pt10
select ExtractValue(@xml, "/entry[(10<pt)]/id");
ExtractValue(@xml, "/entry[(10<pt)]/id")
pt50
select ExtractValue(@xml, "/entry[(10<=pt)]/id");
ExtractValue(@xml, "/entry[(10<=pt)]/id")
pt10 pt50
select ExtractValue(@xml, "/entry[(50=pt)]/id");
ExtractValue(@xml, "/entry[(50=pt)]/id")
pt50
select ExtractValue(@xml, "/entry[(50!=pt)]/id");
ExtractValue(@xml, "/entry[(50!=pt)]/id")
pt10
select ExtractValue(@xml, "/entry[(50>pt)]/id");
ExtractValue(@xml, "/entry[(50>pt)]/id")
pt10
select ExtractValue(@xml, "/entry[(50>=pt)]/id");
ExtractValue(@xml, "/entry[(50>=pt)]/id")
pt10 pt50
select ExtractValue(@xml, "/entry[(50<pt)]/id");
ExtractValue(@xml, "/entry[(50<pt)]/id")
select ExtractValue(@xml, "/entry[(50<=pt)]/id");
ExtractValue(@xml, "/entry[(50<=pt)]/id")
pt50
mysql-test/t/xml.test
View file @
0dd8eb22
...
@@ -376,3 +376,33 @@ select extractValue('<:>test</:>','//*');
...
@@ -376,3 +376,33 @@ select extractValue('<:>test</:>','//*');
select
extractValue
(
'<_>test</_>'
,
'//*'
);
select
extractValue
(
'<_>test</_>'
,
'//*'
);
# dot, dash, underscore and semicolon are good identifier middle characters
# dot, dash, underscore and semicolon are good identifier middle characters
select
extractValue
(
'<x.-_:>test</x.-_:>'
,
'//*'
);
select
extractValue
(
'<x.-_:>test</x.-_:>'
,
'//*'
);
#
# Bug#22823 gt and lt operators appear to be
# reversed in ExtractValue() command
#
set
@
xml
=
"<entry><id>pt10</id><pt>10</pt></entry><entry><id>pt50</id><pt>50</pt></entry>"
;
select
ExtractValue
(
@
xml
,
"/entry[(pt=10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt!=10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt<10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt<=10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt>10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt>=10)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt=50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt!=50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt<50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt<=50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt>50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(pt>=50)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10!=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10>pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10>=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10<pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(10<=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50!=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50>pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50>=pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50<pt)]/id"
);
select
ExtractValue
(
@
xml
,
"/entry[(50<=pt)]/id"
);
sql/item_xmlfunc.cc
View file @
0dd8eb22
...
@@ -532,7 +532,7 @@ public:
...
@@ -532,7 +532,7 @@ public:
longlong
val_int
()
longlong
val_int
()
{
{
Item_func
*
comp
=
(
Item_func
*
)
args
[
1
];
Item_func
*
comp
=
(
Item_func
*
)
args
[
1
];
Item_string
*
fake
=
(
Item_string
*
)(
comp
->
arguments
()[
1
]);
Item_string
*
fake
=
(
Item_string
*
)(
comp
->
arguments
()[
0
]);
String
*
res
=
args
[
0
]
->
val_nodeset
(
&
tmp_nodeset
);
String
*
res
=
args
[
0
]
->
val_nodeset
(
&
tmp_nodeset
);
MY_XPATH_FLT
*
fltbeg
=
(
MY_XPATH_FLT
*
)
res
->
ptr
();
MY_XPATH_FLT
*
fltbeg
=
(
MY_XPATH_FLT
*
)
res
->
ptr
();
MY_XPATH_FLT
*
fltend
=
(
MY_XPATH_FLT
*
)
(
res
->
ptr
()
+
res
->
length
());
MY_XPATH_FLT
*
fltend
=
(
MY_XPATH_FLT
*
)
(
res
->
ptr
()
+
res
->
length
());
...
@@ -884,7 +884,7 @@ static Item *eq_func(int oper, Item *a, Item *b)
...
@@ -884,7 +884,7 @@ static Item *eq_func(int oper, Item *a, Item *b)
Create a comparator function for scalar arguments,
Create a comparator function for scalar arguments,
for the given arguments and reverse operation, e.g.
for the given arguments and reverse operation, e.g.
A >
= B is converted into A < B
A >
B is converted into B < A
RETURN
RETURN
The newly created item.
The newly created item.
...
@@ -895,10 +895,10 @@ static Item *eq_func_reverse(int oper, Item *a, Item *b)
...
@@ -895,10 +895,10 @@ static Item *eq_func_reverse(int oper, Item *a, Item *b)
{
{
case
'='
:
return
new
Item_func_eq
(
a
,
b
);
case
'='
:
return
new
Item_func_eq
(
a
,
b
);
case
'!'
:
return
new
Item_func_ne
(
a
,
b
);
case
'!'
:
return
new
Item_func_ne
(
a
,
b
);
case
MY_XPATH_LEX_GE
:
return
new
Item_func_l
t
(
a
,
b
);
case
MY_XPATH_LEX_GE
:
return
new
Item_func_l
e
(
a
,
b
);
case
MY_XPATH_LEX_LE
:
return
new
Item_func_g
t
(
a
,
b
);
case
MY_XPATH_LEX_LE
:
return
new
Item_func_g
e
(
a
,
b
);
case
MY_XPATH_LEX_GREATER
:
return
new
Item_func_l
e
(
a
,
b
);
case
MY_XPATH_LEX_GREATER
:
return
new
Item_func_l
t
(
a
,
b
);
case
MY_XPATH_LEX_LESS
:
return
new
Item_func_g
e
(
a
,
b
);
case
MY_XPATH_LEX_LESS
:
return
new
Item_func_g
t
(
a
,
b
);
}
}
return
0
;
return
0
;
}
}
...
@@ -951,13 +951,13 @@ static Item *create_comparator(MY_XPATH *xpath,
...
@@ -951,13 +951,13 @@ static Item *create_comparator(MY_XPATH *xpath,
{
{
nodeset
=
(
Item_nodeset_func
*
)
a
;
nodeset
=
(
Item_nodeset_func
*
)
a
;
scalar
=
b
;
scalar
=
b
;
comp
=
eq_func
(
oper
,
scalar
,
fake
);
comp
=
eq_func
(
oper
,
fake
,
scalar
);
}
}
else
else
{
{
nodeset
=
(
Item_nodeset_func
*
)
b
;
nodeset
=
(
Item_nodeset_func
*
)
b
;
scalar
=
a
;
scalar
=
a
;
comp
=
eq_func_reverse
(
oper
,
scalar
,
fake
);
comp
=
eq_func_reverse
(
oper
,
fake
,
scalar
);
}
}
return
new
Item_nodeset_to_const_comparator
(
nodeset
,
comp
,
xpath
->
pxml
);
return
new
Item_nodeset_to_const_comparator
(
nodeset
,
comp
,
xpath
->
pxml
);
}
}
...
...
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