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
ea6d5f9e
Commit
ea6d5f9e
authored
Sep 25, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed error found during review of new pushed code
parent
aa74affb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
18 deletions
+30
-18
client/mysql.cc
client/mysql.cc
+2
-2
mysql-test/r/cast.result
mysql-test/r/cast.result
+12
-0
sql/opt_sum.cc
sql/opt_sum.cc
+7
-7
sql/sql_delete.cc
sql/sql_delete.cc
+3
-2
sql/sql_lex.cc
sql/sql_lex.cc
+0
-1
sql/sql_load.cc
sql/sql_load.cc
+5
-5
sql/sql_prepare.cc
sql/sql_prepare.cc
+0
-1
sql/sql_update.cc
sql/sql_update.cc
+1
-0
No files found.
client/mysql.cc
View file @
ea6d5f9e
...
@@ -993,13 +993,13 @@ static int read_lines(bool execute_commands)
...
@@ -993,13 +993,13 @@ static int read_lines(bool execute_commands)
unsigned
long
clen
;
unsigned
long
clen
;
do
do
{
{
line
=
my_cgets
(
tmpbuf
.
c_ptr
(),
tmpbuf
.
alloced_length
()
,
&
clen
);
line
=
my_cgets
(
tmpbuf
.
ptr
(),
tmpbuf
.
alloced_length
()
-
1
,
&
clen
);
buffer
.
append
(
line
,
clen
);
buffer
.
append
(
line
,
clen
);
/*
/*
if we got buffer fully filled than there is a chance that
if we got buffer fully filled than there is a chance that
something else is still in console input buffer
something else is still in console input buffer
*/
*/
}
while
(
tmpbuf
.
alloced_length
()
<=
clen
+
1
);
}
while
(
tmpbuf
.
alloced_length
()
<=
clen
);
line
=
buffer
.
c_ptr
();
line
=
buffer
.
c_ptr
();
#else
/* OS2 */
#else
/* OS2 */
buffer
.
length
(
0
);
buffer
.
length
(
0
);
...
...
mysql-test/r/cast.result
View file @
ea6d5f9e
...
@@ -54,6 +54,18 @@ CONVERT(DATE "2004-01-22 21:45:33",BINARY(4))
...
@@ -54,6 +54,18 @@ CONVERT(DATE "2004-01-22 21:45:33",BINARY(4))
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
2004
2004
select CAST(0xb3 as signed);
CAST(0xb3 as signed)
179
select CAST(0x8fffffffffffffff as signed);
CAST(0x8fffffffffffffff as signed)
-8070450532247928833
select CAST(0xffffffffffffffff as unsigned);
CAST(0xffffffffffffffff as unsigned)
18446744073709551615
select CAST(0xfffffffffffffffe as signed);
CAST(0xfffffffffffffffe as signed)
-2
select cast('18446744073709551616' as unsigned);
select cast('18446744073709551616' as unsigned);
cast('18446744073709551616' as unsigned)
cast('18446744073709551616' as unsigned)
18446744073709551615
18446744073709551615
...
...
sql/opt_sum.cc
View file @
ea6d5f9e
...
@@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
WHERE t2.field IS NULL;
WHERE t2.field IS NULL;
*/
*/
if
(
tl
->
table
->
map
&
where_tables
)
if
(
tl
->
table
->
map
&
where_tables
)
const_result
=
0
;
return
0
;
}
}
else
else
used_tables
|=
tl
->
table
->
map
;
used_tables
|=
tl
->
table
->
map
;
...
@@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
may be used as the real count.
may be used as the real count.
*/
*/
if
(
tl
->
table
->
file
->
table_flags
()
&
HA_NOT_EXACT_COUNT
)
if
(
tl
->
table
->
file
->
table_flags
()
&
HA_NOT_EXACT_COUNT
)
{
is_exact_count
=
FALSE
;
is_exact_count
=
FALSE
;
count
=
1
;
// ensure count != 0
}
else
else
{
{
tl
->
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
tl
->
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
...
@@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
}
}
}
if
(
!
const_result
)
return
0
;
/*
/*
Iterate through all items in the SELECT clause and replace
Iterate through all items in the SELECT clause and replace
COUNT(), MIN() and MAX() with constants (if possible).
COUNT(), MIN() and MAX() with constants (if possible).
...
@@ -150,8 +150,8 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -150,8 +150,8 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if
(
!
conds
&&
!
((
Item_sum_count
*
)
item
)
->
args
[
0
]
->
maybe_null
&&
if
(
!
conds
&&
!
((
Item_sum_count
*
)
item
)
->
args
[
0
]
->
maybe_null
&&
!
outer_tables
&&
is_exact_count
)
!
outer_tables
&&
is_exact_count
)
{
{
((
Item_sum_count
*
)
item
)
->
make_const
(
count
);
((
Item_sum_count
*
)
item
)
->
make_const
(
count
);
recalc_const_item
=
1
;
recalc_const_item
=
1
;
}
}
else
else
const_result
=
0
;
const_result
=
0
;
...
@@ -234,7 +234,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -234,7 +234,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
}
if
(
!
count
)
if
(
!
count
)
{
{
/* If count
!= 1
, then we know that is_exact_count == TRUE. */
/* If count
== 0
, then we know that is_exact_count == TRUE. */
((
Item_sum_min
*
)
item_sum
)
->
clear
();
/* Set to NULL. */
((
Item_sum_min
*
)
item_sum
)
->
clear
();
/* Set to NULL. */
}
}
else
else
...
...
sql/sql_delete.cc
View file @
ea6d5f9e
...
@@ -27,8 +27,8 @@
...
@@ -27,8 +27,8 @@
#include "ha_innodb.h"
#include "ha_innodb.h"
#include "sql_select.h"
#include "sql_select.h"
int
mysql_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
COND
*
conds
,
SQL_LIST
*
order
,
int
mysql_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
COND
*
conds
,
ha_rows
limit
,
ulong
options
)
SQL_LIST
*
order
,
ha_rows
limit
,
ulong
options
)
{
{
int
error
;
int
error
;
TABLE
*
table
;
TABLE
*
table
;
...
@@ -266,6 +266,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
...
@@ -266,6 +266,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
select_lex
.
table_list
.
first
);
select_lex
.
table_list
.
first
);
DBUG_ENTER
(
"mysql_prepare_delete"
);
DBUG_ENTER
(
"mysql_prepare_delete"
);
thd
->
allow_sum_func
=
0
;
if
(
setup_conds
(
thd
,
delete_table_list
,
conds
)
||
if
(
setup_conds
(
thd
,
delete_table_list
,
conds
)
||
setup_ftfuncs
(
&
thd
->
lex
->
select_lex
))
setup_ftfuncs
(
&
thd
->
lex
->
select_lex
))
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
...
...
sql/sql_lex.cc
View file @
ea6d5f9e
...
@@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length)
...
@@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
duplicates
=
DUP_ERROR
;
lex
->
duplicates
=
DUP_ERROR
;
lex
->
ignore
=
0
;
lex
->
ignore
=
0
;
lex
->
proc_list
.
first
=
0
;
lex
->
proc_list
.
first
=
0
;
thd
->
allow_sum_func
=
0
;
}
}
void
lex_end
(
LEX
*
lex
)
void
lex_end
(
LEX
*
lex
)
...
...
sql/sql_load.cc
View file @
ea6d5f9e
...
@@ -429,8 +429,6 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -429,8 +429,6 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
while
((
sql_field
=
(
Item_field
*
)
it
++
))
while
((
sql_field
=
(
Item_field
*
)
it
++
))
{
{
Field
*
field
=
sql_field
->
field
;
Field
*
field
=
sql_field
->
field
;
if
(
field
==
table
->
next_number_field
)
table
->
auto_increment_field_not_null
=
TRUE
;
if
(
pos
==
read_info
.
row_end
)
if
(
pos
==
read_info
.
row_end
)
{
{
thd
->
cuted_fields
++
;
/* Not enough fields */
thd
->
cuted_fields
++
;
/* Not enough fields */
...
@@ -443,11 +441,13 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -443,11 +441,13 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
{
{
uint
length
;
uint
length
;
byte
save_chr
;
byte
save_chr
;
if
(
field
==
table
->
next_number_field
)
table
->
auto_increment_field_not_null
=
TRUE
;
if
((
length
=
(
uint
)
(
read_info
.
row_end
-
pos
))
>
if
((
length
=
(
uint
)
(
read_info
.
row_end
-
pos
))
>
field
->
field_length
)
field
->
field_length
)
length
=
field
->
field_length
;
length
=
field
->
field_length
;
save_chr
=
pos
[
length
];
pos
[
length
]
=
'\0'
;
// Safeguard aganst malloc
save_chr
=
pos
[
length
];
pos
[
length
]
=
'\0'
;
// Safeguard aganst malloc
field
->
store
((
char
*
)
pos
,
length
,
read_info
.
read_charset
);
field
->
store
((
char
*
)
pos
,
length
,
read_info
.
read_charset
);
pos
[
length
]
=
save_chr
;
pos
[
length
]
=
save_chr
;
if
((
pos
+=
length
)
>
read_info
.
row_end
)
if
((
pos
+=
length
)
>
read_info
.
row_end
)
pos
=
read_info
.
row_end
;
/* Fills rest with space */
pos
=
read_info
.
row_end
;
/* Fills rest with space */
...
@@ -522,8 +522,6 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -522,8 +522,6 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
length
=
(
uint
)
(
read_info
.
row_end
-
pos
);
length
=
(
uint
)
(
read_info
.
row_end
-
pos
);
Field
*
field
=
sql_field
->
field
;
Field
*
field
=
sql_field
->
field
;
if
(
field
==
table
->
next_number_field
)
table
->
auto_increment_field_not_null
=
TRUE
;
if
(
!
read_info
.
enclosed
&&
if
(
!
read_info
.
enclosed
&&
(
enclosed_length
&&
length
==
4
&&
!
memcmp
(
pos
,
"NULL"
,
4
))
||
(
enclosed_length
&&
length
==
4
&&
!
memcmp
(
pos
,
"NULL"
,
4
))
||
(
length
==
1
&&
read_info
.
found_null
))
(
length
==
1
&&
read_info
.
found_null
))
...
@@ -540,6 +538,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -540,6 +538,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
}
}
continue
;
continue
;
}
}
if
(
field
==
table
->
next_number_field
)
table
->
auto_increment_field_not_null
=
TRUE
;
field
->
set_notnull
();
field
->
set_notnull
();
read_info
.
row_end
[
0
]
=
0
;
// Safe to change end marker
read_info
.
row_end
[
0
]
=
0
;
// Safe to change end marker
field
->
store
((
char
*
)
read_info
.
row_start
,
length
,
read_info
.
read_charset
);
field
->
store
((
char
*
)
read_info
.
row_start
,
length
,
read_info
.
read_charset
);
...
...
sql/sql_prepare.cc
View file @
ea6d5f9e
...
@@ -1738,7 +1738,6 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
...
@@ -1738,7 +1738,6 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
lex
->
current_select
=
&
lex
->
select_lex
;
lex
->
current_select
=
&
lex
->
select_lex
;
if
(
lex
->
result
)
if
(
lex
->
result
)
lex
->
result
->
cleanup
();
lex
->
result
->
cleanup
();
thd
->
allow_sum_func
=
0
;
}
}
...
...
sql/sql_update.cc
View file @
ea6d5f9e
...
@@ -426,6 +426,7 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
...
@@ -426,6 +426,7 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
// For ORDER BY
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
// For ORDER BY
tables
.
table
=
table
;
tables
.
table
=
table
;
tables
.
alias
=
table_list
->
alias
;
tables
.
alias
=
table_list
->
alias
;
thd
->
allow_sum_func
=
0
;
if
(
setup_tables
(
update_table_list
)
||
if
(
setup_tables
(
update_table_list
)
||
setup_conds
(
thd
,
update_table_list
,
conds
)
||
setup_conds
(
thd
,
update_table_list
,
conds
)
||
...
...
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