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
8044488d
Commit
8044488d
authored
May 18, 2005
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
28712375
2e936807
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
191 additions
and
8 deletions
+191
-8
mysql-test/r/select.result
mysql-test/r/select.result
+54
-0
mysql-test/t/select.test
mysql-test/t/select.test
+58
-2
sql/sql_list.h
sql/sql_list.h
+72
-2
sql/sql_udf.cc
sql/sql_udf.cc
+6
-4
sql/unireg.cc
sql/unireg.cc
+1
-0
No files found.
mysql-test/r/select.result
View file @
8044488d
...
@@ -2454,4 +2454,58 @@ select all distinct * from t1;
...
@@ -2454,4 +2454,58 @@ select all distinct * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
ERROR HY000: Incorrect usage of ALL and DISTINCT
select distinct all * from t1;
select distinct all * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
ERROR HY000: Incorrect usage of ALL and DISTINCT
DROP TABLE t1;
CREATE TABLE t1 (
kunde_intern_id int(10) unsigned NOT NULL default '0',
kunde_id int(10) unsigned NOT NULL default '0',
FK_firma_id int(10) unsigned NOT NULL default '0',
aktuell enum('Ja','Nein') NOT NULL default 'Ja',
vorname varchar(128) NOT NULL default '',
nachname varchar(128) NOT NULL default '',
geloescht enum('Ja','Nein') NOT NULL default 'Nein',
firma varchar(128) NOT NULL default ''
);
INSERT INTO t1 VALUES
(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
WHERE
(
(
( '' != '' AND firma LIKE CONCAT('%', '', '%'))
OR
(vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND
'Vorname1' != '' AND 'xxxx' != '')
)
AND
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
)
;
kunde_id FK_firma_id aktuell vorname nachname geloescht
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
geloescht FROM t1
WHERE
(
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
AND
(
( '' != '' AND firma LIKE CONCAT('%', '', '%') )
OR
( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
'xxxx' != '')
)
)
;
kunde_id FK_firma_id aktuell vorname nachname geloescht
SELECT COUNT(*) FROM t1 WHERE
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
AND FK_firma_id = 2;
COUNT(*)
0
drop table t1;
drop table t1;
mysql-test/t/select.test
View file @
8044488d
...
@@ -1950,7 +1950,6 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
...
@@ -1950,7 +1950,6 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Test case for bug 7098: substitution of a constant for a string field
# Test case for bug 7098: substitution of a constant for a string field
#
#
...
@@ -1993,5 +1992,62 @@ select all distinct * from t1;
...
@@ -1993,5 +1992,62 @@ select all distinct * from t1;
select
distinct
all
*
from
t1
;
select
distinct
all
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test for BUG#10095
#
CREATE
TABLE
t1
(
kunde_intern_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
kunde_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
FK_firma_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
aktuell
enum
(
'Ja'
,
'Nein'
)
NOT
NULL
default
'Ja'
,
vorname
varchar
(
128
)
NOT
NULL
default
''
,
nachname
varchar
(
128
)
NOT
NULL
default
''
,
geloescht
enum
(
'Ja'
,
'Nein'
)
NOT
NULL
default
'Nein'
,
firma
varchar
(
128
)
NOT
NULL
default
''
);
INSERT
INTO
t1
VALUES
(
3964
,
3051
,
1
,
'Ja'
,
'Vorname1'
,
'1Nachname'
,
'Nein'
,
'Print Schau XXXX'
),
(
3965
,
3051111
,
1
,
'Ja'
,
'Vorname1111'
,
'1111Nachname'
,
'Nein'
,
'Print Schau XXXX'
);
SELECT
kunde_id
,
FK_firma_id
,
aktuell
,
vorname
,
nachname
,
geloescht
FROM
t1
WHERE
(
(
(
''
!=
''
AND
firma
LIKE
CONCAT
(
'%'
,
''
,
'%'
))
OR
(
vorname
LIKE
CONCAT
(
'%'
,
'Vorname1'
,
'%'
)
AND
nachname
LIKE
CONCAT
(
'%'
,
'1Nachname'
,
'%'
)
AND
'Vorname1'
!=
''
AND
'xxxx'
!=
''
)
)
AND
(
aktuell
=
'Ja'
AND
geloescht
=
'Nein'
AND
FK_firma_id
=
2
)
)
;
SELECT
kunde_id
,
FK_firma_id
,
aktuell
,
vorname
,
nachname
,
geloescht
FROM
t1
WHERE
(
(
aktuell
=
'Ja'
AND
geloescht
=
'Nein'
AND
FK_firma_id
=
2
)
AND
(
(
''
!=
''
AND
firma
LIKE
CONCAT
(
'%'
,
''
,
'%'
)
)
OR
(
vorname
LIKE
CONCAT
(
'%'
,
'Vorname1'
,
'%'
)
AND
nachname
LIKE
CONCAT
(
'%'
,
'1Nachname'
,
'%'
)
AND
'Vorname1'
!=
''
AND
'xxxx'
!=
''
)
)
)
;
SELECT
COUNT
(
*
)
FROM
t1
WHERE
(
0
OR
(
vorname
LIKE
'%Vorname1%'
AND
nachname
LIKE
'%1Nachname%'
AND
1
))
AND
FK_firma_id
=
2
;
drop
table
t1
;
sql/sql_list.h
View file @
8044488d
...
@@ -129,10 +129,32 @@ public:
...
@@ -129,10 +129,32 @@ public:
void
remove
(
list_node
**
prev
)
void
remove
(
list_node
**
prev
)
{
{
list_node
*
node
=
(
*
prev
)
->
next
;
list_node
*
node
=
(
*
prev
)
->
next
;
if
(
&
(
*
prev
)
->
next
==
last
)
{
/*
We're removing the last element from the list. Adjust "last" to point
to the previous element.
The other way to fix this would be to change this function to
remove_next() and have base_list_iterator save ptr to previous node
(one extra assignment in iterator++) but as the remove() of the last
element isn't a common operation it's faster to just walk through the
list from the beginning here.
*/
list_node
*
cur
=
first
;
if
(
cur
==
*
prev
)
{
last
=
&
first
;
}
else
{
while
(
cur
->
next
!=
*
prev
)
cur
=
cur
->
next
;
last
=
&
(
cur
->
next
);
}
}
delete
*
prev
;
delete
*
prev
;
*
prev
=
node
;
*
prev
=
node
;
if
(
!--
elements
)
elements
--
;
last
=
&
first
;
}
}
inline
void
concat
(
base_list
*
list
)
inline
void
concat
(
base_list
*
list
)
{
{
...
@@ -162,6 +184,54 @@ public:
...
@@ -162,6 +184,54 @@ public:
friend
class
error_list
;
friend
class
error_list
;
friend
class
error_list_iterator
;
friend
class
error_list_iterator
;
#ifdef LIST_EXTRA_DEBUG
/*
Check list invariants and print results into trace. Invariants are:
- (*last) points to end_of_list
- There are no NULLs in the list.
- base_list::elements is the number of elements in the list.
SYNOPSIS
check_list()
name Name to print to trace file
RETURN
1 The list is Ok.
0 List invariants are not met.
*/
bool
check_list
(
const
char
*
name
)
{
base_list
*
list
=
this
;
list_node
*
node
=
first
;
uint
cnt
=
0
;
while
(
node
->
next
!=
&
end_of_list
)
{
if
(
!
node
->
info
)
{
DBUG_PRINT
(
"list_invariants"
,(
"%s: error: NULL element in the list"
,
name
));
return
FALSE
;
}
node
=
node
->
next
;
cnt
++
;
}
if
(
last
!=
&
(
node
->
next
))
{
DBUG_PRINT
(
"list_invariants"
,
(
"%s: error: wrong last pointer"
,
name
));
return
FALSE
;
}
if
(
cnt
+
1
!=
elements
)
{
DBUG_PRINT
(
"list_invariants"
,
(
"%s: error: wrong element count"
,
name
));
return
FALSE
;
}
DBUG_PRINT
(
"list_invariants"
,
(
"%s: list is ok"
,
name
));
return
TRUE
;
}
#endif // LIST_EXTRA_DEBUG
protected:
protected:
void
after
(
void
*
info
,
list_node
*
node
)
void
after
(
void
*
info
,
list_node
*
node
)
{
{
...
...
sql/sql_udf.cc
View file @
8044488d
...
@@ -193,7 +193,9 @@ void udf_init()
...
@@ -193,7 +193,9 @@ void udf_init()
This is done to ensure that only approved dll from the system
This is done to ensure that only approved dll from the system
directories are used (to make this even remotely secure).
directories are used (to make this even remotely secure).
*/
*/
if
(
strchr
(
dl_name
,
'/'
)
||
name
.
length
>
NAME_LEN
)
if
(
strchr
(
dl_name
,
'/'
)
||
IF_WIN
(
strchr
(
dl_name
,
'\\'
),
0
)
||
strlen
(
name
)
>
NAME_LEN
)
{
{
sql_print_error
(
"Invalid row in mysql.func table for function '%.64s'"
,
sql_print_error
(
"Invalid row in mysql.func table for function '%.64s'"
,
name
.
str
);
name
.
str
);
...
@@ -222,7 +224,7 @@ void udf_init()
...
@@ -222,7 +224,7 @@ void udf_init()
}
}
tmp
->
dlhandle
=
dl
;
tmp
->
dlhandle
=
dl
;
{
{
char
buf
[
MAX_FIELD_NAME
+
16
],
*
missing
;
char
buf
[
NAME_LEN
+
16
],
*
missing
;
if
((
missing
=
init_syms
(
tmp
,
buf
)))
if
((
missing
=
init_syms
(
tmp
,
buf
)))
{
{
sql_print_error
(
ER
(
ER_CANT_FIND_DL_ENTRY
),
missing
);
sql_print_error
(
ER
(
ER_CANT_FIND_DL_ENTRY
),
missing
);
...
@@ -409,7 +411,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
...
@@ -409,7 +411,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
This is done to ensure that only approved dll from the system
This is done to ensure that only approved dll from the system
directories are used (to make this even remotely secure).
directories are used (to make this even remotely secure).
*/
*/
if
(
strchr
(
udf
->
dl
,
'/'
))
if
(
strchr
(
udf
->
dl
,
'/'
)
||
IF_WIN
(
strchr
(
dl_name
,
'\\'
),
0
)
)
{
{
send_error
(
thd
,
ER_UDF_NO_PATHS
,
ER
(
ER_UDF_NO_PATHS
));
send_error
(
thd
,
ER_UDF_NO_PATHS
,
ER
(
ER_UDF_NO_PATHS
));
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -439,7 +441,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
...
@@ -439,7 +441,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
}
}
udf
->
dlhandle
=
dl
;
udf
->
dlhandle
=
dl
;
{
{
char
buf
[
MAX_FIELD_NAME
+
16
],
*
missing
;
char
buf
[
NAME_LEN
+
16
],
*
missing
;
if
((
missing
=
init_syms
(
udf
,
buf
)))
if
((
missing
=
init_syms
(
udf
,
buf
)))
{
{
net_printf
(
thd
,
ER_CANT_FIND_DL_ENTRY
,
missing
);
net_printf
(
thd
,
ER_CANT_FIND_DL_ENTRY
,
missing
);
...
...
sql/unireg.cc
View file @
8044488d
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#define USES_TYPES
#define USES_TYPES
#include "mysql_priv.h"
#include "mysql_priv.h"
#include <m_ctype.h>
#include <m_ctype.h>
#include <assert.h>
#define FCOMP 17
/* Bytes for a packed field */
#define FCOMP 17
/* Bytes for a packed field */
...
...
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