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
c1527b6f
Commit
c1527b6f
authored
Nov 28, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-row-4.1
parents
eb512dce
f60e47fd
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
161 additions
and
152 deletions
+161
-152
libmysql/libmysql.c
libmysql/libmysql.c
+1
-1
mysys/tree.c
mysys/tree.c
+33
-20
regex/Makefile.am
regex/Makefile.am
+1
-1
sql/field.cc
sql/field.cc
+6
-20
sql/ha_heap.cc
sql/ha_heap.cc
+9
-1
sql/ha_heap.h
sql/ha_heap.h
+1
-0
sql/item.h
sql/item.h
+2
-2
sql/item_func.h
sql/item_func.h
+2
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+4
-4
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/item_sum.h
sql/item_sum.h
+2
-2
sql/lex.h
sql/lex.h
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+14
-20
sql/sql_yacc.yy
sql/sql_yacc.yy
+73
-67
strings/ctype-simple.c
strings/ctype-simple.c
+10
-10
No files found.
libmysql/libmysql.c
View file @
c1527b6f
...
...
@@ -4199,7 +4199,7 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
static
void
fetch_result_tinyint
(
MYSQL_BIND
*
param
,
uchar
**
row
)
{
*
param
->
buffer
=
(
uchar
)
**
row
;
*
row
++
;
(
*
row
)
++
;
}
static
void
fetch_result_short
(
MYSQL_BIND
*
param
,
uchar
**
row
)
...
...
mysys/tree.c
View file @
c1527b6f
...
...
@@ -335,30 +335,35 @@ void *tree_search_key(TREE *tree, const void *key,
enum
ha_rkey_function
flag
,
void
*
custom_arg
)
{
int
cmp
;
TREE_ELEMENT
*
element
=
tree
->
root
;
TREE_ELEMENT
**
last_left_step_parent
=
NULL
;
TREE_ELEMENT
**
last_equal_element
=
NULL
;
TREE_ELEMENT
*
element
=
tree
->
root
;
TREE_ELEMENT
**
last_left_step_parent
=
NULL
,
**
last_right_step_parent
=
NULL
;
TREE_ELEMENT
**
last_equal_element
=
NULL
;
/*
TODO: handle HA_READ_KEY_OR_PREV, HA_READ_BEFORE_KEY, HA_READ_PREFIX,
HA_READ_PREFIX_LAST flags if needed.
TODO: support for HA_READ_KEY_OR_PREV, HA_READ_PREFIX flags if needed.
*/
*
parents
=
&
tree
->
null_element
;
while
(
element
!=
&
tree
->
null_element
)
{
*++
parents
=
element
;
if
((
cmp
=
(
*
tree
->
compare
)(
custom_arg
,
ELEMENT_KEY
(
tree
,
element
),
*++
parents
=
element
;
if
((
cmp
=
(
*
tree
->
compare
)(
custom_arg
,
ELEMENT_KEY
(
tree
,
element
),
key
))
==
0
)
{
switch
(
flag
)
{
case
HA_READ_KEY_EXACT
:
case
HA_READ_KEY_OR_NEXT
:
last_equal_element
=
parents
;
cmp
=
1
;
case
HA_READ_BEFORE_KEY
:
last_equal_element
=
parents
;
cmp
=
1
;
break
;
case
HA_READ_AFTER_KEY
:
cmp
=
-
1
;
cmp
=
-
1
;
break
;
case
HA_READ_PREFIX_LAST
:
case
HA_READ_PREFIX_LAST_OR_PREV
:
last_equal_element
=
parents
;
cmp
=
-
1
;
break
;
default:
return
NULL
;
...
...
@@ -366,23 +371,31 @@ void *tree_search_key(TREE *tree, const void *key,
}
if
(
cmp
<
0
)
/* element < key */
{
element
=
element
->
right
;
last_right_step_parent
=
parents
;
element
=
element
->
right
;
}
else
{
last_left_step_parent
=
parents
;
element
=
element
->
left
;
last_left_step_parent
=
parents
;
element
=
element
->
left
;
}
}
switch
(
flag
)
{
case
HA_READ_KEY_EXACT
:
*
last_pos
=
last_equal_element
;
case
HA_READ_PREFIX_LAST
:
*
last_pos
=
last_equal_element
;
break
;
case
HA_READ_KEY_OR_NEXT
:
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_left_step_parent
;
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_left_step_parent
;
break
;
case
HA_READ_AFTER_KEY
:
*
last_pos
=
last_left_step_parent
;
*
last_pos
=
last_left_step_parent
;
break
;
case
HA_READ_PREFIX_LAST_OR_PREV
:
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_right_step_parent
;
break
;
case
HA_READ_BEFORE_KEY
:
*
last_pos
=
last_right_step_parent
;
break
;
default:
return
NULL
;
...
...
regex/Makefile.am
View file @
c1527b6f
...
...
@@ -17,7 +17,7 @@
INCLUDES
=
@MT_INCLUDES@
-I
$(top_srcdir)
/include
noinst_LIBRARIES
=
libregex.a
LDADD
=
libregex.a ../strings/libmystrings.a
LDADD
=
libregex.a ../strings/libmystrings.a
../mysys/libmysys.a
noinst_HEADERS
=
cclass.h cname.h regex2.h utils.h engine.c regex.h
libregex_a_SOURCES
=
regerror.c regcomp.c regexec.c regfree.c reginit.c
noinst_PROGRAMS
=
re
...
...
sql/field.cc
View file @
c1527b6f
...
...
@@ -15,16 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
NOTES:
Some of the number class uses the system functions strtol(), strtoll()...
To avoid patching the end \0 or copying the buffer unnecessary, all calls
to system functions are wrapped to a String object that adds the end null
if it only if it isn't there.
This adds some overhead when assigning numbers from strings but makes
everything simpler.
*/
/*****************************************************************************
** This file implements classes defined in field.h
*****************************************************************************/
...
...
@@ -1592,7 +1582,6 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
}
long
tmp
;
int
error
=
0
;
String
tmp_str
(
from
,
len
,
default_charset_info
);
errno
=
0
;
if
(
unsigned_flag
)
{
...
...
@@ -1603,10 +1592,10 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
error
=
1
;
}
else
tmp
=
(
long
)
strtoul
(
tmp_str
.
c_ptr
()
,
NULL
,
10
);
tmp
=
(
long
)
my_strntoul
(
cs
,
from
,
len
,
NULL
,
10
);
}
else
tmp
=
strtol
(
tmp_str
.
c_ptr
()
,
NULL
,
10
);
tmp
=
my_strntol
(
cs
,
from
,
len
,
NULL
,
10
);
if
(
errno
||
current_thd
->
count_cuted_fields
&&
!
test_if_int
(
from
,
len
))
{
current_thd
->
cuted_fields
++
;
...
...
@@ -1837,7 +1826,6 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
len
--
;
from
++
;
}
longlong
tmp
;
String
tmp_str
(
from
,
len
,
default_charset_info
);
int
error
=
0
;
errno
=
0
;
if
(
unsigned_flag
)
...
...
@@ -1849,10 +1837,10 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
error
=
1
;
}
else
tmp
=
(
longlong
)
strtoull
(
tmp_str
.
c_ptr
()
,
NULL
,
10
);
tmp
=
(
longlong
)
my_strntoull
(
cs
,
from
,
len
,
NULL
,
10
);
}
else
tmp
=
strtoll
(
tmp_str
.
c_ptr
()
,
NULL
,
10
);
tmp
=
my_strntoll
(
cs
,
from
,
len
,
NULL
,
10
);
if
(
errno
||
current_thd
->
count_cuted_fields
&&
!
test_if_int
(
from
,
len
))
{
current_thd
->
cuted_fields
++
;
...
...
@@ -2052,9 +2040,8 @@ void Field_longlong::sql_type(String &res) const
int
Field_float
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
String
tmp_str
(
from
,
len
,
default_charset_info
);
errno
=
0
;
Field_float
::
store
(
atof
(
tmp_str
.
c_ptr
()
));
Field_float
::
store
(
my_strntod
(
cs
,
from
,
len
,(
char
**
)
NULL
));
if
(
errno
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
))
{
current_thd
->
cuted_fields
++
;
...
...
@@ -2314,10 +2301,9 @@ void Field_float::sql_type(String &res) const
int
Field_double
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
String
tmp_str
(
from
,
len
,
default_charset_info
);
errno
=
0
;
int
error
=
0
;
double
j
=
atof
(
tmp_str
.
c_ptr
()
);
double
j
=
my_strntod
(
cs
,
from
,
len
,(
char
**
)
0
);
if
(
errno
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
))
{
current_thd
->
cuted_fields
++
;
...
...
sql/ha_heap.cc
View file @
c1527b6f
...
...
@@ -81,6 +81,15 @@ int ha_heap::index_read(byte * buf, const byte * key, uint key_len,
return
error
;
}
int
ha_heap
::
index_read_last
(
byte
*
buf
,
const
byte
*
key
,
uint
key_len
)
{
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
heap_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
HA_READ_PREFIX_LAST
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
return
error
;
}
int
ha_heap
::
index_read_idx
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
...
...
@@ -90,7 +99,6 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
return
error
;
}
int
ha_heap
::
index_next
(
byte
*
buf
)
{
statistic_increment
(
ha_read_next_count
,
&
LOCK_status
);
...
...
sql/ha_heap.h
View file @
c1527b6f
...
...
@@ -67,6 +67,7 @@ class ha_heap: public handler
uint
key_len
,
enum
ha_rkey_function
find_flag
);
int
index_read_idx
(
byte
*
buf
,
uint
idx
,
const
byte
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
);
int
index_read_last
(
byte
*
buf
,
const
byte
*
key
,
uint
key_len
);
int
index_next
(
byte
*
buf
);
int
index_prev
(
byte
*
buf
);
int
index_first
(
byte
*
buf
);
...
...
sql/item.h
View file @
c1527b6f
...
...
@@ -542,9 +542,9 @@ class Item_copy_string :public Item
enum
Type
type
()
const
{
return
COPY_STR_ITEM
;
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
double
val
()
{
return
null_value
?
0.0
:
atof
(
str_value
.
c_ptr
()
);
}
{
return
null_value
?
0.0
:
my_strntod
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
NULL
);
}
longlong
val_int
()
{
return
null_value
?
LL
(
0
)
:
strtoll
(
str_value
.
c_ptr
(),(
char
**
)
0
,
10
);
}
{
return
null_value
?
LL
(
0
)
:
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),(
char
**
)
0
,
10
);
}
String
*
val_str
(
String
*
);
void
make_field
(
Send_field
*
field
)
{
item
->
make_field
(
field
);
}
void
copy
();
...
...
sql/item_func.h
View file @
c1527b6f
...
...
@@ -845,12 +845,12 @@ class Item_func_udf_str :public Item_udf_func
double
val
()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
atof
(
res
->
c_ptr
()
)
:
0.0
;
return
res
?
my_strntod
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
0
)
:
0.0
;
}
longlong
val_int
()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
strtoll
(
res
->
c_ptr
(),(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
();
...
...
sql/item_strfunc.cc
View file @
c1527b6f
...
...
@@ -54,14 +54,14 @@ double Item_str_func::val()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
atof
(
res
->
c_ptr
()
)
:
0.0
;
return
res
?
my_strntod
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
NULL
)
:
0.0
;
}
longlong
Item_str_func
::
val_int
()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
strtoll
(
res
->
c_ptr
(),
NULL
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
NULL
,
10
)
:
(
longlong
)
0
;
}
...
...
@@ -1905,9 +1905,9 @@ String *Item_func_conv::val_str(String *str)
}
null_value
=
0
;
if
(
from_base
<
0
)
dec
=
strtoll
(
res
->
c_ptr
(),
&
endptr
,
-
from_base
);
dec
=
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
&
endptr
,
-
from_base
);
else
dec
=
(
longlong
)
strtoull
(
res
->
c_ptr
(),
&
endptr
,
from_base
);
dec
=
(
longlong
)
my_strntoull
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
&
endptr
,
from_base
);
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
),
thd_charset
()))
return
&
empty_string
;
...
...
sql/item_sum.cc
View file @
c1527b6f
...
...
@@ -334,7 +334,7 @@ double Item_sum_hybrid::val()
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
atof
(
res
->
c_ptr
()
)
:
0.0
;
return
res
?
my_strntod
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),(
char
**
)
0
)
:
0.0
;
case
INT_RESULT
:
if
(
unsigned_flag
)
return
ulonglong2double
(
sum_int
);
...
...
sql/item_sum.h
View file @
c1527b6f
...
...
@@ -442,12 +442,12 @@ class Item_sum_udf_str :public Item_udf_sum
double
val
()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
atof
(
res
->
c_ptr
()
)
:
0.0
;
return
res
?
my_strntod
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),(
char
**
)
0
)
:
0.0
;
}
longlong
val_int
()
{
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
strtoll
(
res
->
c_ptr
(),(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
();
...
...
sql/lex.h
View file @
c1527b6f
...
...
@@ -135,6 +135,7 @@ static SYMBOL symbols[] = {
{
"DROP"
,
SYM
(
DROP
),
0
,
0
},
{
"DUMPFILE"
,
SYM
(
DUMPFILE
),
0
,
0
},
{
"DYNAMIC"
,
SYM
(
DYNAMIC_SYM
),
0
,
0
},
{
"DUPLICATE"
,
SYM
(
DUPLICATE
),
0
,
0
},
{
"ERRORS"
,
SYM
(
ERRORS
),
0
,
0
},
{
"END"
,
SYM
(
END
),
0
,
0
},
{
"ELSE"
,
SYM
(
ELSE
),
0
,
0
},
...
...
sql/sql_parse.cc
View file @
c1527b6f
...
...
@@ -1961,25 +1961,19 @@ mysql_execute_command(THD *thd)
close_thread_tables
(
thd
);
}
break
;
case
SQLCOM_REPLACE
:
case
SQLCOM_INSERT
:
if
(
check_access
(
thd
,
INSERT_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
{
ulong
privilege
=
(
lex
->
duplicates
==
DUP_REPLACE
?
INSERT_ACL
|
DELETE_ACL
:
INSERT_ACL
);
if
(
check_access
(
thd
,
privilege
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
goto
error
;
/* purecov: inspected */
if
(
grant_option
&&
check_grant
(
thd
,
INSERT_ACL
,
tables
))
if
(
grant_option
&&
check_grant
(
thd
,
privilege
,
tables
))
goto
error
;
res
=
mysql_insert
(
thd
,
tables
,
lex
->
field_list
,
lex
->
many_values
,
lex
->
duplicates
);
break
;
case
SQLCOM_REPLACE
:
if
(
check_access
(
thd
,
INSERT_ACL
|
DELETE_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
goto
error
;
/* purecov: inspected */
if
(
grant_option
&&
check_grant
(
thd
,
INSERT_ACL
|
DELETE_ACL
,
tables
))
goto
error
;
res
=
mysql_insert
(
thd
,
tables
,
lex
->
field_list
,
lex
->
many_values
,
DUP_REPLACE
);
break
;
}
case
SQLCOM_REPLACE_SELECT
:
case
SQLCOM_INSERT_SELECT
:
{
...
...
@@ -1989,8 +1983,8 @@ mysql_execute_command(THD *thd)
select privileges for the rest
*/
{
ulong
privilege
=
(
lex
->
sql_command
==
SQLCOM_INSERT_SELECT
?
INSERT_ACL
:
INSERT_ACL
|
DELETE
_ACL
);
ulong
privilege
=
(
lex
->
duplicates
==
DUP_REPLACE
?
INSERT_ACL
|
DELETE_ACL
:
INSERT
_ACL
);
TABLE_LIST
*
save_next
=
tables
->
next
;
tables
->
next
=
0
;
if
(
check_access
(
thd
,
privilege
,
...
...
sql/sql_yacc.yy
View file @
c1527b6f
This diff is collapsed.
Click to expand it.
strings/ctype-simple.c
View file @
c1527b6f
...
...
@@ -18,6 +18,8 @@
#include "m_string.h"
#include "m_ctype.h"
#include "my_sys.h"
/* defines errno */
#include <errno.h>
#include "stdarg.h"
#include "assert.h"
...
...
@@ -246,8 +248,6 @@ void my_hash_sort_simple(CHARSET_INFO *cs,
}
#define MY_ERRNO(y)
long
my_strntol_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
{
...
...
@@ -349,14 +349,14 @@ long my_strntol_8bit(CHARSET_INFO *cs,
if
(
overflow
)
{
MY_ERRNO
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
negative
?
LONG_MIN
:
LONG_MAX
;
}
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
noconv:
MY_ERRNO
(
EDOM
);
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
...
...
@@ -455,14 +455,14 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
if
(
overflow
)
{
MY_ERRNO
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
((
ulong
)
~
0L
);
}
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
noconv:
MY_ERRNO
(
EDOM
);
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
...
...
@@ -570,14 +570,14 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)),
if
(
overflow
)
{
MY_ERRNO
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
noconv:
MY_ERRNO
(
EDOM
);
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
...
...
@@ -677,14 +677,14 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs,
if
(
overflow
)
{
MY_ERRNO
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
(
~
(
ulonglong
)
0
);
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
noconv:
MY_ERRNO
(
EDOM
);
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
...
...
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