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
b5a5cb4a
Commit
b5a5cb4a
authored
Aug 09, 2006
by
evgen@sunlight.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge sunlight.local:/home/evgen/bk-trees/mysql-5.0
into sunlight.local:/local_work/leak_fix
parents
f72600ca
1250b06a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
19 deletions
+47
-19
sql/sql_base.cc
sql/sql_base.cc
+31
-13
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_view.cc
sql/sql_view.cc
+9
-3
sql/sql_view.h
sql/sql_view.h
+2
-1
sql/table.cc
sql/table.cc
+2
-0
sql/unireg.h
sql/unireg.h
+2
-1
No files found.
sql/sql_base.cc
View file @
b5a5cb4a
...
...
@@ -34,7 +34,8 @@ HASH open_cache; /* Used by mysql_test */
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
const
char
*
db
,
const
char
*
name
,
const
char
*
alias
,
TABLE_LIST
*
table_list
,
MEM_ROOT
*
mem_root
);
TABLE_LIST
*
table_list
,
MEM_ROOT
*
mem_root
,
uint
flags
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
mysql_rm_tmp_tables
(
void
);
static
bool
open_new_frm
(
THD
*
thd
,
const
char
*
path
,
const
char
*
alias
,
...
...
@@ -1108,7 +1109,7 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
if
(
open_unireg_entry
(
thd
,
table
,
db
,
table_name
,
table_name
,
0
,
thd
->
mem_root
)
||
thd
->
mem_root
,
0
)
||
!
(
table
->
s
->
table_cache_key
=
memdup_root
(
&
table
->
mem_root
,
(
char
*
)
key
,
key_length
)))
{
...
...
@@ -1311,7 +1312,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
!
open_unireg_entry
(
thd
,
table
,
table_list
->
db
,
table_list
->
table_name
,
alias
,
table_list
,
mem_root
))
alias
,
table_list
,
mem_root
,
0
))
{
DBUG_ASSERT
(
table_list
->
view
!=
0
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
...
...
@@ -1391,6 +1392,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
else
{
TABLE_SHARE
*
share
;
int
error
;
/* Free cache if too big */
while
(
open_cache
.
records
>
table_cache_size
&&
unused_tables
)
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
/* purecov: tested */
...
...
@@ -1401,9 +1403,12 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
NULL
);
}
if
(
open_unireg_entry
(
thd
,
table
,
table_list
->
db
,
table_list
->
table_name
,
alias
,
table_list
,
mem_root
)
||
(
!
table_list
->
view
&&
error
=
open_unireg_entry
(
thd
,
table
,
table_list
->
db
,
table_list
->
table_name
,
alias
,
table_list
,
mem_root
,
(
flags
&
OPEN_VIEW_NO_PARSE
));
if
((
error
>
0
)
||
(
!
table_list
->
view
&&
!
error
&&
!
(
table
->
s
->
table_cache_key
=
memdup_root
(
&
table
->
mem_root
,
(
char
*
)
key
,
key_length
))))
...
...
@@ -1413,8 +1418,15 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
NULL
);
}
if
(
table_list
->
view
)
if
(
table_list
->
view
||
error
<
0
)
{
/*
VIEW not really opened, only frm were read.
Set 1 as a flag here
*/
if
(
error
<
0
)
table_list
->
view
=
(
st_lex
*
)
1
;
my_free
((
gptr
)
table
,
MYF
(
0
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
0
);
// VIEW
...
...
@@ -1521,7 +1533,7 @@ bool reopen_table(TABLE *table,bool locked)
safe_mutex_assert_owner
(
&
LOCK_open
);
if
(
open_unireg_entry
(
table
->
in_use
,
&
tmp
,
db
,
table_name
,
table
->
alias
,
0
,
table
->
in_use
->
mem_root
))
table
->
alias
,
0
,
table
->
in_use
->
mem_root
,
0
))
goto
end
;
free_io_cache
(
table
);
...
...
@@ -1851,6 +1863,8 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
alias Alias name
table_desc TABLE_LIST descriptor (used with views)
mem_root temporary mem_root for parsing
flags the OPEN_VIEW_NO_PARSE flag to be passed to
openfrm()/open_new_frm()
NOTES
Extra argument for open is taken from thd->open_options
...
...
@@ -1861,7 +1875,8 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
*/
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
const
char
*
db
,
const
char
*
name
,
const
char
*
alias
,
TABLE_LIST
*
table_desc
,
MEM_ROOT
*
mem_root
)
TABLE_LIST
*
table_desc
,
MEM_ROOT
*
mem_root
,
uint
flags
)
{
char
path
[
FN_REFLEN
];
int
error
;
...
...
@@ -1873,14 +1888,16 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
(
uint
)
(
HA_OPEN_KEYFILE
|
HA_OPEN_RNDFILE
|
HA_GET_INDEX
|
HA_TRY_READ_ONLY
|
NO_ERR_ON_NEW_FRM
),
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
,
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
|
(
flags
&
OPEN_VIEW_NO_PARSE
),
thd
->
open_options
,
entry
))
&&
(
error
!=
5
||
(
fn_format
(
path
,
path
,
0
,
reg_ext
,
MY_UNPACK_FILENAME
),
open_new_frm
(
thd
,
path
,
alias
,
db
,
name
,
(
uint
)
(
HA_OPEN_KEYFILE
|
HA_OPEN_RNDFILE
|
HA_GET_INDEX
|
HA_TRY_READ_ONLY
),
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
,
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
|
(
flags
&
OPEN_VIEW_NO_PARSE
),
thd
->
open_options
,
entry
,
table_desc
,
mem_root
))))
{
...
...
@@ -1962,7 +1979,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
}
if
(
error
==
5
)
DBUG_RETURN
(
0
);
// we have just opened VIEW
DBUG_RETURN
(
(
flags
&
OPEN_VIEW_NO_PARSE
)
?
-
1
:
0
);
// we have just opened VIEW
/*
We can't mark all tables in 'mysql' database as system since we don't
...
...
@@ -5379,7 +5396,8 @@ open_new_frm(THD *thd, const char *path, const char *alias,
my_error
(
ER_WRONG_OBJECT
,
MYF
(
0
),
db
,
table_name
,
"BASE TABLE"
);
goto
err
;
}
if
(
mysql_make_view
(
thd
,
parser
,
table_desc
))
if
(
mysql_make_view
(
thd
,
parser
,
table_desc
,
(
prgflag
&
OPEN_VIEW_NO_PARSE
)))
goto
err
;
}
else
...
...
sql/sql_lex.h
View file @
b5a5cb4a
...
...
@@ -375,7 +375,7 @@ public:
friend
class
st_select_lex_unit
;
friend
bool
mysql_new_select
(
struct
st_lex
*
lex
,
bool
move_down
);
friend
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
);
TABLE_LIST
*
table
,
uint
flags
);
private:
void
fast_exclude
();
};
...
...
sql/sql_view.cc
View file @
b5a5cb4a
...
...
@@ -185,7 +185,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
if
(
view
->
view
)
free_view
=
0
;
memcpy
(
&
decoy
,
view
,
sizeof
(
TABLE_LIST
));
if
((
decoy
.
table
=
open_table
(
thd
,
&
decoy
,
thd
->
mem_root
,
NULL
,
0
)))
if
(
!
open_table
(
thd
,
&
decoy
,
thd
->
mem_root
,
&
not_used
,
OPEN_VIEW_NO_PARSE
)
&&
!
decoy
.
view
)
{
/* It's a table */
my_free
((
gptr
)
decoy
.
table
,
MYF
(
0
));
...
...
@@ -827,13 +828,14 @@ loop_out:
thd Thread handler
parser parser object
table TABLE_LIST structure for filling
flags flags
RETURN
0 ok
1 error
*/
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
)
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
,
uint
flags
)
{
SELECT_LEX
*
end
,
*
view_select
;
LEX
*
old_lex
,
*
lex
;
...
...
@@ -924,6 +926,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
table
->
db
,
table
->
table_name
);
get_default_definer
(
thd
,
&
table
->
definer
);
}
if
(
flags
&
OPEN_VIEW_NO_PARSE
)
{
DBUG_RETURN
(
FALSE
);
}
/*
Save VIEW parameters, which will be wiped out by derived table
...
...
sql/sql_view.h
View file @
b5a5cb4a
...
...
@@ -19,7 +19,8 @@
bool
mysql_create_view
(
THD
*
thd
,
enum_view_create_mode
mode
);
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
);
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
,
uint
flags
);
bool
mysql_drop_view
(
THD
*
thd
,
TABLE_LIST
*
view
,
enum_drop_mode
drop_mode
);
...
...
sql/table.cc
View file @
b5a5cb4a
...
...
@@ -121,6 +121,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
// caller can't process new .frm
goto
err
;
}
if
(
prgflag
&
OPEN_VIEW_NO_PARSE
)
goto
err
;
share
->
blob_ptr_size
=
sizeof
(
char
*
);
outparam
->
db_stat
=
db_stat
;
...
...
sql/unireg.h
View file @
b5a5cb4a
...
...
@@ -147,7 +147,8 @@
#define READ_SCREENS 1024
/* Read screens, info and helpfile */
#define DELAYED_OPEN 4096
/* Open table later */
#define NO_ERR_ON_NEW_FRM 8192
/* stop error sending on new format */
#define OPEN_VIEW_NO_PARSE 16384
/* Open frm only if it's a view,
but do not parse view itself */
#define SC_INFO_LENGTH 4
/* Form format constant */
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
...
...
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