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
57a85986
Commit
57a85986
authored
Oct 14, 2004
by
monty@mishka.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mishka.local:/home/my/mysql-4.1
parents
3aaae0e3
719c88e3
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
183 additions
and
129 deletions
+183
-129
include/my_sys.h
include/my_sys.h
+1
-1
mysys/hash.c
mysys/hash.c
+41
-16
mysys/my_bitmap.c
mysys/my_bitmap.c
+2
-2
sql/examples/ha_archive.cc
sql/examples/ha_archive.cc
+3
-2
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+61
-55
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+3
-3
sql/handler.cc
sql/handler.cc
+25
-13
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+19
-20
sql/log_event.h
sql/log_event.h
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+10
-3
sql/sql_help.cc
sql/sql_help.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+8
-4
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-2
sql/sql_table.cc
sql/sql_table.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
include/my_sys.h
View file @
57a85986
...
...
@@ -726,7 +726,7 @@ extern void my_free_lock(byte *ptr,myf flags);
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; } while(0)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0;
(A)->min_malloc=0;
} while(0)
extern
void
init_alloc_root
(
MEM_ROOT
*
mem_root
,
uint
block_size
,
uint
pre_alloc_size
);
extern
gptr
alloc_root
(
MEM_ROOT
*
mem_root
,
unsigned
int
Size
);
...
...
mysys/hash.c
View file @
57a85986
...
...
@@ -72,19 +72,48 @@ _hash_init(HASH *hash,CHARSET_INFO *charset,
}
void
hash_free
(
HASH
*
hash
)
/*
Call hash->free on all elements in hash.
SYNOPSIS
hash_free_elements()
hash hash table
NOTES:
Sets records to 0
*/
static
void
inline
hash_free_elements
(
HASH
*
hash
)
{
DBUG_ENTER
(
"hash_free"
);
if
(
hash
->
free
)
{
uint
i
,
records
;
HASH_LINK
*
data
=
dynamic_element
(
&
hash
->
array
,
0
,
HASH_LINK
*
);
for
(
i
=
0
,
records
=
hash
->
records
;
i
<
records
;
i
++
)
(
*
hash
->
free
)(
data
[
i
].
data
);
hash
->
free
=
0
;
HASH_LINK
*
end
=
data
+
hash
->
records
;
while
(
data
<
end
)
(
*
hash
->
free
)((
data
++
)
->
data
)
;
}
delete_dynamic
(
&
hash
->
array
);
hash
->
records
=
0
;
}
/*
Free memory used by hash.
SYNOPSIS
hash_free()
hash the hash to delete elements of
NOTES: Hash can't be reused wuthing calling hash_init again.
*/
void
hash_free
(
HASH
*
hash
)
{
DBUG_ENTER
(
"hash_free"
);
DBUG_PRINT
(
"enter"
,(
"hash: 0x%lxd"
,
hash
));
hash_free_elements
(
hash
);
hash
->
free
=
0
;
delete_dynamic
(
&
hash
->
array
);
DBUG_VOID_RETURN
;
}
...
...
@@ -94,21 +123,17 @@ void hash_free(HASH *hash)
SYNOPSIS
hash_reset()
hash the hash to delete elements of
hash the hash to delete elements of
*/
void
hash_reset
(
HASH
*
hash
)
{
DBUG_ENTER
(
"hash_reset"
);
if
(
hash
->
free
)
{
HASH_LINK
*
link
=
dynamic_element
(
&
hash
->
array
,
0
,
HASH_LINK
*
);
HASH_LINK
*
end
=
link
+
hash
->
records
;
for
(;
link
<
end
;
++
link
)
(
*
hash
->
free
)(
link
->
data
);
}
DBUG_PRINT
(
"enter"
,(
"hash: 0x%lxd"
,
hash
));
hash_free_elements
(
hash
);
reset_dynamic
(
&
hash
->
array
);
hash
->
records
=
0
;
/* Set row pointers so that the hash can be reused at once */
hash
->
blength
=
1
;
hash
->
current_record
=
NO_RECORD
;
DBUG_VOID_RETURN
;
...
...
mysys/my_bitmap.c
View file @
57a85986
...
...
@@ -38,7 +38,7 @@
#include <m_string.h>
inline
void
bitmap_lock
(
MY_BITMAP
*
map
)
static
inline
void
bitmap_lock
(
MY_BITMAP
*
map
)
{
#ifdef THREAD
if
(
map
->
mutex
)
...
...
@@ -47,7 +47,7 @@ inline void bitmap_lock(MY_BITMAP *map)
}
inline
void
bitmap_unlock
(
MY_BITMAP
*
map
)
static
inline
void
bitmap_unlock
(
MY_BITMAP
*
map
)
{
#ifdef THREAD
if
(
map
->
mutex
)
...
...
sql/examples/ha_archive.cc
View file @
57a85986
...
...
@@ -103,14 +103,15 @@
rows - This is an unsigned long long which is the number of rows in the data
file.
check point - Reserved for future use
dirty - Status of the file, whether or not its values are the latest. This
flag
is what causes a repair to occur
dirty - Status of the file, whether or not its values are the latest. This
flag
is what causes a repair to occur
The data file:
check - Just an int of 254 to make sure that the the file we are opening was
never corrupted.
version - The current version of the file format.
data - The data is stored in a "row +blobs" format.
*/
/* Variables for archive share methods */
pthread_mutex_t
archive_mutex
;
...
...
sql/ha_ndbcluster.cc
View file @
57a85986
This diff is collapsed.
Click to expand it.
sql/ha_ndbcluster.h
View file @
57a85986
...
...
@@ -139,12 +139,12 @@ class ha_ndbcluster: public handler
bool
low_byte_first
()
const
{
#ifdef WORDS_BIGENDIAN
return
false
;
return
FALSE
;
#else
return
true
;
return
TRUE
;
#endif
}
bool
has_transactions
()
{
return
true
;
}
bool
has_transactions
()
{
return
TRUE
;
}
const
char
*
index_type
(
uint
key_number
)
{
switch
(
get_index_type
(
key_number
))
{
...
...
sql/handler.cc
View file @
57a85986
...
...
@@ -1105,6 +1105,11 @@ void handler::print_error(int error, myf errflag)
break
;
case
HA_ERR_NO_SUCH_TABLE
:
{
/*
We have to use path to find database name instead of using
table->table_cache_key because if the table didn't exist, then
table_cache_key was not set up
*/
char
*
db
;
char
buff
[
FN_REFLEN
];
uint
length
=
dirname_part
(
buff
,
table
->
path
);
...
...
@@ -1276,23 +1281,26 @@ int ha_create_table_from_engine(THD* thd,
const
char
*
name
,
bool
create_if_found
)
{
int
error
=
0
;
const
void
*
frmblob
=
NULL
;
uint
frmlen
=
0
;
int
error
;
const
void
*
frmblob
;
uint
frmlen
;
char
path
[
FN_REFLEN
];
HA_CREATE_INFO
create_info
;
TABLE
table
;
DBUG_ENTER
(
"ha_create_table_from_engine"
);
DBUG_PRINT
(
"enter"
,
(
"
db: %s, name: %s"
,
db
,
name
));
DBUG_PRINT
(
"enter"
,
(
"create_if_found: %d"
,
create_if_found
));
DBUG_PRINT
(
"enter"
,
(
"
name '%s'.'%s' create_if_found: %d"
,
db
,
name
,
create_if_found
));
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
if
((
error
=
ha_discover
(
thd
,
db
,
name
,
&
frmblob
,
&
frmlen
)))
DBUG_RETURN
(
error
);
/*
Table exists in handler
frmblob and frmlen are set
*/
// Table exists in handler
if
(
create_if_found
)
if
(
create_if_found
)
{
(
void
)
strxnmov
(
path
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
db
,
"/"
,
name
,
NullS
);
// Save the frm file
...
...
@@ -1309,9 +1317,7 @@ int ha_create_table_from_engine(THD* thd,
!
(
table
.
file
->
table_flags
()
&
HA_FILE_BASED
))
{
/* Ensure that handler gets name in lower case */
strmov
(
path
,
name
);
my_casedn_str
(
files_charset_info
,
path
);
name
=
path
;
}
error
=
table
.
file
->
create
(
path
,
&
table
,
&
create_info
);
...
...
@@ -1319,8 +1325,7 @@ int ha_create_table_from_engine(THD* thd,
}
err_end:
if
(
frmblob
)
my_free
((
char
*
)
frmblob
,
MYF
(
0
));
my_free
((
char
*
)
frmblob
,
MYF
(
MY_ALLOW_ZERO
));
DBUG_RETURN
(
error
);
}
...
...
@@ -1429,10 +1434,14 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
/*
Try to discover one table from handler(s)
RETURN
0 ok. In this case *frmblob and *frmlen are set
1 error. frmblob and frmlen may not be set
*/
int
ha_discover
(
THD
*
thd
,
const
char
*
db
,
const
char
*
name
,
const
void
**
frmblob
,
uint
*
frmlen
)
int
ha_discover
(
THD
*
thd
,
const
char
*
db
,
const
char
*
name
,
const
void
**
frmblob
,
uint
*
frmlen
)
{
int
error
=
1
;
// Table does not exist in any handler
DBUG_ENTER
(
"ha_discover"
);
...
...
@@ -1470,6 +1479,8 @@ ha_find_files(THD *thd,const char *db,const char *path,
}
#ifdef NOT_YET_USED
/*
Ask handler if the table exists in engine
...
...
@@ -1491,6 +1502,7 @@ int ha_table_exists(THD* thd, const char* db, const char* name)
DBUG_RETURN
(
error
);
}
#endif
/*
...
...
sql/item_cmpfunc.h
View file @
57a85986
...
...
@@ -845,7 +845,7 @@ class Item_func_like :public Item_bool_func2
char
escape
;
Item_func_like
(
Item
*
a
,
Item
*
b
,
Item
*
escape_arg
)
:
Item_bool_func2
(
a
,
b
),
canDoTurboBM
(
false
),
pattern
(
0
),
pattern_len
(
0
),
:
Item_bool_func2
(
a
,
b
),
canDoTurboBM
(
FALSE
),
pattern
(
0
),
pattern_len
(
0
),
bmGs
(
0
),
bmBc
(
0
),
escape_item
(
escape_arg
)
{}
longlong
val_int
();
enum
Functype
functype
()
const
{
return
LIKE_FUNC
;
}
...
...
sql/item_strfunc.cc
View file @
57a85986
...
...
@@ -2709,41 +2709,40 @@ longlong Item_func_crc32::val_int()
String
*
Item_func_compress
::
val_str
(
String
*
str
)
{
int
err
=
Z_OK
,
code
;
ulong
new_size
;
String
*
res
;
Byte
*
body
;
char
*
tmp
,
*
last_char
;
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
if
(
!
res
)
if
(
!
(
res
=
args
[
0
]
->
val_str
(
str
))
)
{
null_value
=
1
;
return
0
;
}
if
(
res
->
is_empty
())
return
res
;
int
err
=
Z_OK
;
int
code
;
/*
c
itation from zlib.h (comment for compress function):
C
itation from zlib.h (comment for compress function):
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least 0.1% larger than
sourceLen plus 12 bytes.
Proportion 120/100 founded by Sinisa with help of procedure
compress(compress(compress(...)))
I.e. zlib give number 'at least'..
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least 0.1% larger than
sourceLen plus 12 bytes.
We assume here that the buffer can't grow more than .25 %.
*/
ulong
new_size
=
res
->
length
()
+
res
->
length
()
/
5
+
12
;
new_size
=
res
->
length
()
+
res
->
length
()
/
5
+
12
;
//
Will c
heck new_size overflow: new_size <= res->length()
if
(((
uint32
)
new_size
<=
res
->
length
())
||
//
C
heck new_size overflow: new_size <= res->length()
if
(((
uint32
)
(
new_size
+
5
)
<=
res
->
length
())
||
buffer
.
realloc
((
uint32
)
new_size
+
4
+
1
))
{
null_value
=
1
;
return
0
;
}
Byte
*
body
=
((
Byte
*
)
buffer
.
ptr
())
+
4
;
body
=
((
Byte
*
)
buffer
.
ptr
())
+
4
;
// As far as we have checked res->is_empty() we can use ptr()
if
((
err
=
compress
(
body
,
&
new_size
,
...
...
@@ -2755,11 +2754,11 @@ String *Item_func_compress::val_str(String *str)
return
0
;
}
char
*
tmp
=
(
char
*
)
buffer
.
ptr
();
// int4store is a macro; avoid side effects
tmp
=
(
char
*
)
buffer
.
ptr
();
// int4store is a macro; avoid side effects
int4store
(
tmp
,
res
->
length
()
&
0x3FFFFFFF
);
/* This is
for the stupid char fields
which trim ' ': */
char
*
last_char
=
((
char
*
)
body
)
+
new_size
-
1
;
/* This is
to ensure that things works for CHAR fields,
which trim ' ': */
last_char
=
((
char
*
)
body
)
+
new_size
-
1
;
if
(
*
last_char
==
' '
)
{
*++
last_char
=
'.'
;
...
...
sql/log_event.h
View file @
57a85986
...
...
@@ -571,7 +571,7 @@ class Load_log_event: public Log_event
{
fname
=
afname
;
fname_len
=
alen
;
local_fname
=
true
;
local_fname
=
TRUE
;
}
/* fname doesn't point to memory inside Log_event::temp_buf */
int
check_fname_outside_temp_buf
()
...
...
sql/sql_base.cc
View file @
57a85986
...
...
@@ -1368,7 +1368,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
*/
if
(
discover_retry_count
++
!=
0
)
goto
err
;
if
(
ha_create_table_from_engine
(
thd
,
db
,
name
,
true
)
!=
0
)
if
(
ha_create_table_from_engine
(
thd
,
db
,
name
,
TRUE
)
!=
0
)
goto
err
;
thd
->
clear_error
();
// Clear error message
...
...
@@ -2846,8 +2846,15 @@ void flush_tables()
/*
** Mark all entries with the table as deleted to force an reopen of the table
** Returns true if the table is in use by another thread
Mark all entries with the table as deleted to force an reopen of the table
The table will be closed (not stored in cache) by the current thread when
close_thread_tables() is called.
RETURN
0 This thread now have exclusive access to this table and no other thread
can access the table until close_thread_tables() is called.
1 Table is in use by another thread
*/
bool
remove_table_from_cache
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
...
...
sql/sql_help.cc
View file @
57a85986
...
...
@@ -746,7 +746,7 @@ int mysqld_help(THD *thd, const char *mask)
select
,
&
subcategories_list
);
delete
select
;
String
*
cat
=
categories_list
.
head
();
if
(
send_header_2
(
protocol
,
true
)
||
if
(
send_header_2
(
protocol
,
TRUE
)
||
send_variant_2_list
(
mem_root
,
protocol
,
&
topics_list
,
"N"
,
cat
)
||
send_variant_2_list
(
mem_root
,
protocol
,
&
subcategories_list
,
"Y"
,
cat
))
goto
end
;
...
...
sql/sql_lex.cc
View file @
57a85986
...
...
@@ -477,7 +477,6 @@ inline static uint int_token(const char *str,uint length)
int
yylex
(
void
*
arg
,
void
*
yythd
)
{
reg1
uchar
c
;
bool
space_ignored
;
int
tokval
,
result_state
;
uint
length
;
enum
my_lex_states
state
;
...
...
@@ -560,6 +559,7 @@ int yylex(void *arg, void *yythd)
/* Fall through */
case
MY_LEX_IDENT_OR_BIN
:
// TODO: Add binary string handling
case
MY_LEX_IDENT
:
uchar
*
start
;
#if defined(USE_MB) && defined(USE_MB_IDENT)
if
(
use_mb
(
cs
))
{
...
...
@@ -596,12 +596,16 @@ int yylex(void *arg, void *yythd)
result_state
=
result_state
&
0x80
?
IDENT_QUOTED
:
IDENT
;
}
length
=
(
uint
)
(
lex
->
ptr
-
lex
->
tok_start
)
-
1
;
s
pace_ignored
=
FALSE
;
s
tart
=
lex
->
ptr
;
if
(
lex
->
ignore_space
)
{
for
(;
state_map
[
c
]
==
MY_LEX_SKIP
;
space_ignored
=
TRUE
,
c
=
yyGet
());
/*
If we find a space then this can't be an identifier. We notice this
below by checking start != lex->ptr.
*/
for
(;
state_map
[
c
]
==
MY_LEX_SKIP
;
c
=
yyGet
());
}
if
(
!
space_ignored
&&
c
==
'.'
&&
ident_map
[
yyPeek
()])
if
(
start
==
lex
->
ptr
&&
c
==
'.'
&&
ident_map
[
yyPeek
()])
lex
->
next_state
=
MY_LEX_IDENT_SEP
;
else
{
// '(' must follow directly if function
...
...
sql/sql_parse.cc
View file @
57a85986
...
...
@@ -894,7 +894,7 @@ static int check_connection(THD *thd)
x_free
(
thd
->
user
);
if
(
!
(
thd
->
user
=
my_strdup
(
user
,
MYF
(
0
))))
return
(
ER_OUT_OF_RESOURCES
);
return
check_user
(
thd
,
COM_CONNECT
,
passwd
,
passwd_len
,
db
,
true
);
return
check_user
(
thd
,
COM_CONNECT
,
passwd
,
passwd_len
,
db
,
TRUE
);
}
...
...
@@ -4767,7 +4767,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
acl_reload
(
thd
);
grant_reload
(
thd
);
if
(
mqh_used
)
reset_mqh
(
thd
,(
LEX_USER
*
)
NULL
,
true
);
reset_mqh
(
thd
,(
LEX_USER
*
)
NULL
,
TRUE
);
}
#endif
if
(
options
&
REFRESH_LOG
)
...
...
sql/sql_prepare.cc
View file @
57a85986
...
...
@@ -1781,7 +1781,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
goto
set_params_data_err
;
#endif
thd
->
protocol
=
&
thd
->
protocol_prep
;
// Switch to binary protocol
execute_stmt
(
thd
,
stmt
,
&
expanded_query
,
true
);
execute_stmt
(
thd
,
stmt
,
&
expanded_query
,
TRUE
);
thd
->
protocol
=
&
thd
->
protocol_simple
;
// Use normal protocol
DBUG_VOID_RETURN
;
...
...
@@ -1834,7 +1834,7 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"EXECUTE"
);
send_error
(
thd
);
}
execute_stmt
(
thd
,
stmt
,
&
expanded_query
,
false
);
execute_stmt
(
thd
,
stmt
,
&
expanded_query
,
FALSE
);
DBUG_VOID_RETURN
;
}
...
...
sql/sql_table.cc
View file @
57a85986
...
...
@@ -223,7 +223,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
(
void
)
unpack_filename
(
path
,
path
);
}
if
(
drop_temporary
||
(
access
(
path
,
F_OK
)
&&
ha_create_table_from_engine
(
thd
,
db
,
alias
,
true
)))
(
access
(
path
,
F_OK
)
&&
ha_create_table_from_engine
(
thd
,
db
,
alias
,
TRUE
)))
{
if
(
if_exists
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
...
...
sql/sql_yacc.yy
View file @
57a85986
...
...
@@ -843,14 +843,14 @@ prepare_src:
THD *thd=YYTHD;
LEX *lex= thd->lex;
lex->prepared_stmt_code= $1;
lex->prepared_stmt_code_is_varref=
false
;
lex->prepared_stmt_code_is_varref=
FALSE
;
}
| '@' ident_or_text
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
lex->prepared_stmt_code= $2;
lex->prepared_stmt_code_is_varref=
true
;
lex->prepared_stmt_code_is_varref=
TRUE
;
};
execute:
...
...
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