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
ae8eb2d9
Commit
ae8eb2d9
authored
Nov 18, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
c0764205
46beea06
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
15 deletions
+69
-15
mysql-test/r/derived.result
mysql-test/r/derived.result
+25
-0
mysql-test/r/select_found.result
mysql-test/r/select_found.result
+10
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+12
-0
mysql-test/t/select_found.test
mysql-test/t/select_found.test
+4
-0
sql/sql_delete.cc
sql/sql_delete.cc
+5
-7
sql/sql_derived.cc
sql/sql_derived.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+6
-3
sql/sql_table.cc
sql/sql_table.cc
+5
-4
sql/sql_union.cc
sql/sql_union.cc
+1
-0
No files found.
mysql-test/r/derived.result
View file @
ae8eb2d9
...
@@ -40,3 +40,28 @@ a
...
@@ -40,3 +40,28 @@ a
select 1 from (select 1);
select 1 from (select 1);
1
1
1
1
drop table if exists t1;
create table t1(a int not null, t char(8), index(a));
SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
a t
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
drop table if exists t1;
mysql-test/r/select_found.result
View file @
ae8eb2d9
...
@@ -168,4 +168,14 @@ test2 2 2
...
@@ -168,4 +168,14 @@ test2 2 2
SELECT FOUND_ROWS();
SELECT FOUND_ROWS();
FOUND_ROWS()
FOUND_ROWS()
2
2
SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
1
SELECT FOUND_ROWS();
FOUND_ROWS()
1
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
titre numeropost maxnumrep
SELECT FOUND_ROWS();
FOUND_ROWS()
3
drop table t1;
drop table t1;
mysql-test/t/derived.test
View file @
ae8eb2d9
...
@@ -22,3 +22,15 @@ drop table if exists t1.t2,t3;
...
@@ -22,3 +22,15 @@ drop table if exists t1.t2,t3;
select
*
from
(
select
1
);
select
*
from
(
select
1
);
select
a
from
(
select
1
as
a
);
select
a
from
(
select
1
as
a
);
select
1
from
(
select
1
);
select
1
from
(
select
1
);
drop
table
if
exists
t1
;
create
table
t1
(
a
int
not
null
,
t
char
(
8
),
index
(
a
));
disable_query_log
;
let
$
1
=
10000
;
while
(
$
1
)
{
eval
insert
into
t1
values
(
$
1
,
'$1'
);
dec
$
1
;
}
enable_query_log
;
SELECT
*
FROM
(
SELECT
*
FROM
t1
)
ORDER
BY
a
ASC
LIMIT
0
,
20
;
drop
table
if
exists
t1
;
\ No newline at end of file
mysql-test/t/select_found.test
View file @
ae8eb2d9
...
@@ -84,4 +84,8 @@ INSERT INTO t1 (titre,maxnumrep) VALUES
...
@@ -84,4 +84,8 @@ INSERT INTO t1 (titre,maxnumrep) VALUES
(
'test1'
,
'1'
),(
'test2'
,
'2'
),(
'test3'
,
'3'
);
(
'test1'
,
'1'
),(
'test2'
,
'2'
),(
'test3'
,
'3'
);
SELECT
SQL_CALC_FOUND_ROWS
titre
,
numeropost
,
maxnumrep
FROM
t1
WHERE
numeropost
IN
(
1
,
2
)
ORDER
BY
maxnumrep
DESC
LIMIT
0
,
1
;
SELECT
SQL_CALC_FOUND_ROWS
titre
,
numeropost
,
maxnumrep
FROM
t1
WHERE
numeropost
IN
(
1
,
2
)
ORDER
BY
maxnumrep
DESC
LIMIT
0
,
1
;
SELECT
FOUND_ROWS
();
SELECT
FOUND_ROWS
();
SELECT
SQL_CALC_FOUND_ROWS
1
FROM
(
SELECT
1
)
LIMIT
0
;
SELECT
FOUND_ROWS
();
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t1
LIMIT
0
;
SELECT
FOUND_ROWS
();
drop
table
t1
;
drop
table
t1
;
sql/sql_delete.cc
View file @
ae8eb2d9
...
@@ -35,13 +35,13 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
...
@@ -35,13 +35,13 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
SQL_SELECT
*
select
=
0
;
SQL_SELECT
*
select
=
0
;
READ_RECORD
info
;
READ_RECORD
info
;
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
using_transactions
;
bool
using_transactions
,
safe_update
;
ha_rows
deleted
;
ha_rows
deleted
;
DBUG_ENTER
(
"mysql_delete"
);
DBUG_ENTER
(
"mysql_delete"
);
if
(
!
table_list
->
db
)
if
(
!
table_list
->
db
)
table_list
->
db
=
thd
->
db
;
table_list
->
db
=
thd
->
db
;
if
((
thd
->
options
&
OPTION_SAFE_UPDATES
)
&&
!
conds
)
if
((
(
safe_update
=
thd
->
options
&
OPTION_SAFE_UPDATES
)
)
&&
!
conds
)
{
{
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -58,7 +58,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
...
@@ -58,7 +58,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
/* Test if the user wants to delete all rows */
/* Test if the user wants to delete all rows */
if
(
!
using_limit
&&
(
!
conds
||
conds
->
const_item
())
&&
if
(
!
using_limit
&&
(
!
conds
||
conds
->
const_item
())
&&
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
)))
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
))
&&
!
safe_update
)
{
{
deleted
=
table
->
file
->
records
;
deleted
=
table
->
file
->
records
;
if
(
!
(
error
=
table
->
file
->
delete_all_rows
()))
if
(
!
(
error
=
table
->
file
->
delete_all_rows
()))
...
@@ -79,9 +79,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
...
@@ -79,9 +79,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
)
if
(
error
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
if
((
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
OPTION_SAFE_UPDATES
),
if
((
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
limit
))
||
!
limit
)
{
{
delete
select
;
delete
select
;
send_ok
(
thd
,
0L
);
send_ok
(
thd
,
0L
);
...
@@ -92,7 +90,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
...
@@ -92,7 +90,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if
(
!
table
->
quick_keys
)
if
(
!
table
->
quick_keys
)
{
{
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_INDEX_USED
;
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_INDEX_USED
;
if
(
(
thd
->
options
&
OPTION_SAFE_UPDATES
)
&&
limit
==
HA_POS_ERROR
)
if
(
safe_update
&&
!
using_limit
)
{
{
delete
select
;
delete
select
;
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
...
...
sql/sql_derived.cc
View file @
ae8eb2d9
...
@@ -119,7 +119,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
...
@@ -119,7 +119,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
table
->
tmp_table
=
TMP_TABLE
;
table
->
tmp_table
=
TMP_TABLE
;
if
(
!
lex
->
describe
)
if
(
!
lex
->
describe
)
sl
->
exclude
();
sl
->
exclude
();
t
->
db
=
""
;
t
->
db
=
(
char
*
)
""
;
t
->
derived
=
(
SELECT_LEX
*
)
0
;
// just in case ...
t
->
derived
=
(
SELECT_LEX
*
)
0
;
// just in case ...
}
}
}
}
...
...
sql/sql_select.cc
View file @
ae8eb2d9
...
@@ -378,7 +378,7 @@ JOIN::optimize()
...
@@ -378,7 +378,7 @@ JOIN::optimize()
error
=
0
;
error
=
0
;
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
cond_value
==
Item
::
COND_FALSE
||
!
unit
->
select_limit_cnt
)
if
(
cond_value
==
Item
::
COND_FALSE
||
(
!
unit
->
select_limit_cnt
&&
!
(
select_options
&
OPTION_FOUND_ROWS
))
)
{
/* Impossible cond */
{
/* Impossible cond */
zero_result_cause
=
"Impossible WHERE"
;
zero_result_cause
=
"Impossible WHERE"
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
@@ -664,10 +664,13 @@ JOIN::exec()
...
@@ -664,10 +664,13 @@ JOIN::exec()
result
->
send_fields
(
fields_list
,
1
);
result
->
send_fields
(
fields_list
,
1
);
if
(
!
having
||
having
->
val_int
())
if
(
!
having
||
having
->
val_int
())
{
{
if
(
do_send_rows
&&
result
->
send_data
(
fields_list
))
if
(
do_send_rows
&&
unit
->
select_limit_cnt
&&
result
->
send_data
(
fields_list
))
error
=
1
;
error
=
1
;
else
else
{
error
=
(
int
)
result
->
send_eof
();
error
=
(
int
)
result
->
send_eof
();
send_records
=
1
;
}
}
}
else
else
error
=
(
int
)
result
->
send_eof
();
error
=
(
int
)
result
->
send_eof
();
...
@@ -5181,7 +5184,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
...
@@ -5181,7 +5184,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
error
=
0
;
error
=
0
;
if
(
join
->
procedure
)
if
(
join
->
procedure
)
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
);
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
);
else
if
(
join
->
do_send_rows
)
else
if
(
join
->
do_send_rows
&&
join
->
unit
->
select_limit_cnt
)
error
=
join
->
result
->
send_data
(
*
join
->
fields
);
error
=
join
->
result
->
send_data
(
*
join
->
fields
);
if
(
error
)
if
(
error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
...
...
sql/sql_table.cc
View file @
ae8eb2d9
...
@@ -523,19 +523,19 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -523,19 +523,19 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
key_iterator
.
rewind
();
key_iterator
.
rewind
();
key_number
=
0
;
key_number
=
0
;
for
(;
(
key
=
key_iterator
++
)
;
key_
info
++
,
key_
number
++
)
for
(;
(
key
=
key_iterator
++
)
;
key_number
++
)
{
{
uint
key_length
=
0
;
uint
key_length
=
0
;
key_part_spec
*
column
;
key_part_spec
*
column
;
switch
(
key
->
type
){
switch
(
key
->
type
){
case
Key
:
:
MULTIPLE
:
case
Key
:
:
MULTIPLE
:
key_info
->
flags
=
0
;
key_info
->
flags
=
0
;
break
;
break
;
case
Key
:
:
FULLTEXT
:
case
Key
:
:
FULLTEXT
:
key_info
->
flags
=
HA_FULLTEXT
;
key_info
->
flags
=
HA_FULLTEXT
;
break
;
break
;
case
Key
:
:
SPATIAL
:
case
Key
:
:
SPATIAL
:
key_info
->
flags
=
HA_SPATIAL
;
key_info
->
flags
=
HA_SPATIAL
;
break
;
break
;
case
Key
:
:
FOREIGN_KEY
:
case
Key
:
:
FOREIGN_KEY
:
...
@@ -734,6 +734,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -734,6 +734,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
my_error
(
ER_TOO_LONG_KEY
,
MYF
(
0
),
max_key_length
);
my_error
(
ER_TOO_LONG_KEY
,
MYF
(
0
),
max_key_length
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
key_info
++
;
}
}
if
(
!
unique_key
&&
!
primary_key
&&
if
(
!
unique_key
&&
!
primary_key
&&
(
file
->
table_flags
()
&
HA_REQUIRE_PRIMARY_KEY
))
(
file
->
table_flags
()
&
HA_REQUIRE_PRIMARY_KEY
))
...
...
sql/sql_union.cc
View file @
ae8eb2d9
...
@@ -86,6 +86,7 @@ bool select_union::send_data(List<Item> &values)
...
@@ -86,6 +86,7 @@ bool select_union::send_data(List<Item> &values)
}
}
else
else
return
1
;
return
1
;
thd
->
net
.
report_error
=
0
;
// donno why does it work, but it does ...
}
}
return
0
;
return
0
;
}
}
...
...
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