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
8a9d2d95
Commit
8a9d2d95
authored
Nov 09, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/my/mysql-4.0 into hundin.mysql.fi:/my/mysql-4.0
parents
05136a90
60feecf4
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
958 additions
and
15 deletions
+958
-15
Docs/internals.texi
Docs/internals.texi
+797
-4
configure.in
configure.in
+6
-0
include/my_global.h
include/my_global.h
+4
-0
libmysql/password.c
libmysql/password.c
+1
-1
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+36
-1
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+40
-1
mysys/hash.c
mysys/hash.c
+10
-5
mysys/my_static.c
mysys/my_static.c
+1
-1
mysys/my_static.h
mysys/my_static.h
+1
-1
mysys/my_tempnam.c
mysys/my_tempnam.c
+6
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+39
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+3
-0
sql/opt_sum.cc
sql/opt_sum.cc
+13
-0
sql/sql_analyse.cc
sql/sql_analyse.cc
+1
-1
No files found.
Docs/internals.texi
View file @
8a9d2d95
This diff is collapsed.
Click to expand it.
configure.in
View file @
8a9d2d95
...
...
@@ -934,6 +934,12 @@ case $SYSTEM_TYPE in
echo
"Using --with-named-thread=-lpthread"
with_named_thread
=
"-lpthread"
fi
# Fixes for HPUX 11.0 compiler
if
test
"
$ac_cv_prog_gcc
"
=
"no"
then
CFLAGS
=
"
$CFLAGS
+DD64 -DHAVE_BROKEN_INLINE"
CXXFLAGS
=
"
$CXXFLAGS
+DD64 +O2"
fi
;;
*
rhapsody
*
)
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
...
...
include/my_global.h
View file @
8a9d2d95
...
...
@@ -141,6 +141,10 @@ C_MODE_END
#undef HAVE_PREAD
#undef HAVE_PWRITE
#endif
#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
#undef inline
#define inline
#endif
#ifdef UNDEF_HAVE_GETHOSTBYNAME_R
/* For OSF4.x */
#undef HAVE_GETHOSTBYNAME_R
...
...
libmysql/password.c
View file @
8a9d2d95
...
...
@@ -91,7 +91,7 @@ void make_scrambled_password(char *to,const char *password)
sprintf
(
to
,
"%08lx%08lx"
,
hash_res
[
0
],
hash_res
[
1
]);
}
static
inline
uint
char_val
(
char
X
)
static
inline
u
nsigned
int
char_val
(
char
X
)
{
return
(
uint
)
(
X
>=
'0'
&&
X
<=
'9'
?
X
-
'0'
:
X
>=
'A'
&&
X
<=
'Z'
?
X
-
'A'
+
10
:
...
...
mysql-test/r/group_by.result
View file @
8a9d2d95
drop table if exists t1,t2;
drop table if exists t1,t2
,t3
;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
...
...
@@ -417,3 +417,38 @@ xID xID1 Level
3 134 ***
4 185 ****
drop table t1;
CREATE TABLE t1 (
pid int(11) unsigned NOT NULL default '0',
c1id int(11) unsigned default NULL,
c2id int(11) unsigned default NULL,
value int(11) unsigned NOT NULL default '0',
UNIQUE KEY pid2 (pid,c1id,c2id),
UNIQUE KEY pid (pid,value)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
CREATE TABLE t2 (
id int(11) unsigned NOT NULL default '0',
active enum('Yes','No') NOT NULL default 'Yes',
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
CREATE TABLE t3 (
id int(11) unsigned NOT NULL default '0',
active enum('Yes','No') NOT NULL default 'Yes',
PRIMARY KEY (id)
);
INSERT INTO t3 VALUES (3, 'Yes');
select * from t1 AS m LEFT JOIN t2 AS c1 ON m.c1id =
c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = c2.id AND
c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS NOT NULL);
pid c1id c2id value id active id active
1 1 NULL 1 1 Yes NULL NULL
1 NULL 3 3 NULL NULL 3 Yes
1 4 NULL 4 4 Yes NULL NULL
select max(value) from t1 AS m LEFT JOIN t2 AS c1 ON
m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
NOT NULL);
max(value)
4
drop table t1,t2,t3;
mysql-test/t/group_by.test
View file @
8a9d2d95
...
...
@@ -2,7 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
,
t3
;
CREATE
TABLE
t1
(
spID
int
(
10
)
unsigned
,
userID
int
(
10
)
unsigned
,
...
...
@@ -312,3 +312,42 @@ insert into t1 values (1,244,NULL),(2,243,NULL),(134,223,NULL),(185,186,NULL);
select
S
.
ID
as
xID
,
S
.
ID1
as
xID1
from
t1
as
S
left
join
t1
as
yS
on
S
.
ID1
between
yS
.
ID1
and
yS
.
ID2
;
select
S
.
ID
as
xID
,
S
.
ID1
as
xID1
,
repeat
(
'*'
,
count
(
distinct
yS
.
ID
))
as
Level
from
t1
as
S
left
join
t1
as
yS
on
S
.
ID1
between
yS
.
ID1
and
yS
.
ID2
group
by
xID
order
by
xID1
;
drop
table
t1
;
#
# Problem with MAX and LEFT JOIN
#
CREATE
TABLE
t1
(
pid
int
(
11
)
unsigned
NOT
NULL
default
'0'
,
c1id
int
(
11
)
unsigned
default
NULL
,
c2id
int
(
11
)
unsigned
default
NULL
,
value
int
(
11
)
unsigned
NOT
NULL
default
'0'
,
UNIQUE
KEY
pid2
(
pid
,
c1id
,
c2id
),
UNIQUE
KEY
pid
(
pid
,
value
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
NULL
,
1
),(
1
,
2
,
NULL
,
2
),(
1
,
NULL
,
3
,
3
),(
1
,
4
,
NULL
,
4
),(
1
,
5
,
NULL
,
5
);
CREATE
TABLE
t2
(
id
int
(
11
)
unsigned
NOT
NULL
default
'0'
,
active
enum
(
'Yes'
,
'No'
)
NOT
NULL
default
'Yes'
,
PRIMARY
KEY
(
id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
1
,
'Yes'
),(
2
,
'No'
),(
4
,
'Yes'
),(
5
,
'No'
);
CREATE
TABLE
t3
(
id
int
(
11
)
unsigned
NOT
NULL
default
'0'
,
active
enum
(
'Yes'
,
'No'
)
NOT
NULL
default
'Yes'
,
PRIMARY
KEY
(
id
)
);
INSERT
INTO
t3
VALUES
(
3
,
'Yes'
);
select
*
from
t1
AS
m
LEFT
JOIN
t2
AS
c1
ON
m
.
c1id
=
c1
.
id
AND
c1
.
active
=
'Yes'
LEFT
JOIN
t3
AS
c2
ON
m
.
c2id
=
c2
.
id
AND
c2
.
active
=
'Yes'
WHERE
m
.
pid
=
1
AND
(
c1
.
id
IS
NOT
NULL
OR
c2
.
id
IS
NOT
NULL
);
select
max
(
value
)
from
t1
AS
m
LEFT
JOIN
t2
AS
c1
ON
m
.
c1id
=
c1
.
id
AND
c1
.
active
=
'Yes'
LEFT
JOIN
t3
AS
c2
ON
m
.
c2id
=
c2
.
id
AND
c2
.
active
=
'Yes'
WHERE
m
.
pid
=
1
AND
(
c1
.
id
IS
NOT
NULL
OR
c2
.
id
IS
NOT
NULL
);
drop
table
t1
,
t2
,
t3
;
mysys/hash.c
View file @
8a9d2d95
...
...
@@ -82,7 +82,12 @@ void hash_free(HASH *hash)
/* some helper functions */
inline
byte
*
/*
This function is char* instead of byte* as HPUX11 compiler can't
handle inline functions that are not defined as native types
*/
inline
char
*
hash_key
(
HASH
*
hash
,
const
byte
*
record
,
uint
*
length
,
my_bool
first
)
{
if
(
hash
->
get_key
)
...
...
@@ -103,7 +108,7 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
uint
maxlength
)
{
uint
length
;
byte
*
key
=
hash_key
(
hash
,
pos
->
data
,
&
length
,
0
);
byte
*
key
=
(
byte
*
)
hash_key
(
hash
,
pos
->
data
,
&
length
,
0
);
return
hash_mask
((
*
hash
->
calc_hashnr
)(
key
,
length
),
buffmax
,
maxlength
);
}
...
...
@@ -180,10 +185,10 @@ uint calc_hashnr_caseup(const byte *key, uint len)
#ifndef __SUNPRO_C
/* SUNPRO can't handle this */
inline
#endif
uint
rec_hashnr
(
HASH
*
hash
,
const
byte
*
record
)
u
nsigned
int
rec_hashnr
(
HASH
*
hash
,
const
byte
*
record
)
{
uint
length
;
byte
*
key
=
hash_key
(
hash
,
record
,
&
length
,
0
);
byte
*
key
=
(
byte
*
)
hash_key
(
hash
,
record
,
&
length
,
0
);
return
(
*
hash
->
calc_hashnr
)(
key
,
length
);
}
...
...
@@ -270,7 +275,7 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
static
int
hashcmp
(
HASH
*
hash
,
HASH_LINK
*
pos
,
const
byte
*
key
,
uint
length
)
{
uint
rec_keylength
;
byte
*
rec_key
=
hash_key
(
hash
,
pos
->
data
,
&
rec_keylength
,
1
);
byte
*
rec_key
=
(
byte
*
)
hash_key
(
hash
,
pos
->
data
,
&
rec_keylength
,
1
);
return
(
length
&&
length
!=
rec_keylength
)
||
(
hash
->
flags
&
HASH_CASE_INSENSITIVE
?
my_casecmp
(
rec_key
,
key
,
rec_keylength
)
:
...
...
mysys/my_static.c
View file @
8a9d2d95
...
...
@@ -60,7 +60,7 @@ USED_MEM* my_once_root_block=0; /* pointer to first block */
uint
my_once_extra
=
ONCE_ALLOC_INIT
;
/* Memory to alloc / block */
/* from my_tempnam */
#if
ndef HAVE_TEMPNAM
#if
!defined(HAVE_TEMPNAM) || defined(HPUX11)
int
_my_tempnam_used
=
0
;
#endif
...
...
mysys/my_static.h
View file @
8a9d2d95
...
...
@@ -65,7 +65,7 @@ extern const char *soundex_map;
extern
USED_MEM
*
my_once_root_block
;
extern
uint
my_once_extra
;
#if
ndef HAVE_TEMPNAM
#if
!defined(HAVE_TEMPNAM) || defined(HPUX11)
extern
int
_my_tempnam_used
;
#endif
...
...
mysys/my_tempnam.c
View file @
8a9d2d95
...
...
@@ -23,6 +23,12 @@
#include "mysys_priv.h"
#include <m_string.h>
/* HPUX 11.0 doesn't allow us to change the environ pointer */
#ifdef HPUX11
#undef HAVE_TEMPNAM
#endif
#include "my_static.h"
#include "mysys_err.h"
...
...
sql/item_cmpfunc.cc
View file @
8a9d2d95
...
...
@@ -1236,6 +1236,45 @@ longlong Item_cond_or::val_int()
return
0
;
}
/*
Create an AND expression from two expressions
SYNOPSIS
and_expressions()
a expression or NULL
b expression.
org_item Don't modify a if a == *org_item
If a == NULL, org_item is set to point at b,
to ensure that future calls will not modify b.
NOTES
This will not modify item pointed to by org_item or b
The idea is that one can call this in a loop and create and
'and' over all items without modifying any of the original items.
RETURN
NULL Error
Item
*/
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
)
{
if
(
!
a
)
return
(
*
org_item
=
(
Item
*
)
b
);
if
(
a
==
*
org_item
)
{
Item_cond
*
res
;
if
((
res
=
new
Item_cond_and
(
a
,
(
Item
*
)
b
)))
res
->
used_tables_cache
=
a
->
used_tables
()
|
b
->
used_tables
();
return
res
;
}
if
(((
Item_cond_and
*
)
a
)
->
add
((
Item
*
)
b
))
return
0
;
((
Item_cond_and
*
)
a
)
->
used_tables_cache
|=
b
->
used_tables
();
return
a
;
}
longlong
Item_func_isnull
::
val_int
()
{
/*
...
...
sql/item_cmpfunc.h
View file @
8a9d2d95
...
...
@@ -621,3 +621,6 @@ class Item_cond_xor :public Item_cond
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"xor"
;
}
};
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
);
sql/opt_sum.cc
View file @
8a9d2d95
...
...
@@ -37,6 +37,19 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
bool
recalc_const_item
=
0
;
table_map
removed_tables
=
0
;
Item
*
item
;
COND
*
org_conds
=
conds
;
/* Add all ON conditions to WHERE condition */
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next
)
{
if
(
tl
->
on_expr
)
conds
=
and_expressions
(
conds
,
tl
->
on_expr
,
&
org_conds
);
}
/*
Iterate through item is select part and replace COUNT(), MIN() and MAX()
with constants (if possible)
*/
while
((
item
=
it
++
))
{
...
...
sql/sql_analyse.cc
View file @
8a9d2d95
...
...
@@ -677,7 +677,7 @@ bool analyse::end_of_records()
case
FIELD_TYPE_DECIMAL
:
ans
.
append
(
"DECIMAL"
,
7
);
// if item is FIELD_ITEM, it _must_be_ Field_num in this case
if
(((
Field_num
*
)
(
*
f
)
->
item
)
->
zerofill
)
if
(((
Field_num
*
)
(
(
Item_field
*
)
(
*
f
)
->
item
)
->
field
)
->
zerofill
)
ans
.
append
(
" ZEROFILL"
);
break
;
default:
...
...
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