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
33cabdc3
Commit
33cabdc3
authored
May 06, 2003
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand the mysql.proc table
parent
4e40725c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
13 deletions
+113
-13
mysql-test/install_test_db.sh
mysql-test/install_test_db.sh
+5
-0
scripts/mysql_install_db.sh
scripts/mysql_install_db.sh
+5
-0
sql/sp.cc
sql/sp.cc
+59
-5
sql/sp.h
sql/sp.h
+4
-2
sql/sp_head.cc
sql/sp_head.cc
+17
-3
sql/sp_head.h
sql/sp_head.h
+21
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/install_test_db.sh
View file @
33cabdc3
...
@@ -253,6 +253,11 @@ then
...
@@ -253,6 +253,11 @@ then
c_p
=
"
$c_p
name char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
name char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
type enum('function','procedure') NOT NULL,"
c_p
=
"
$c_p
type enum('function','procedure') NOT NULL,"
c_p
=
"
$c_p
body blob DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
body blob DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
creator char(77) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
created timestamp,"
c_p
=
"
$c_p
modified timestamp,"
c_p
=
"
$c_p
suid enum ('N', 'Y') DEFAULT 'Y' NOT NULL,"
c_p
=
"
$c_p
comment char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
PRIMARY KEY (name,type)"
c_p
=
"
$c_p
PRIMARY KEY (name,type)"
c_p
=
"
$c_p
)"
c_p
=
"
$c_p
)"
c_p
=
"
$c_p
comment='Stored Procedures';"
c_p
=
"
$c_p
comment='Stored Procedures';"
...
...
scripts/mysql_install_db.sh
View file @
33cabdc3
...
@@ -361,6 +361,11 @@ then
...
@@ -361,6 +361,11 @@ then
c_p
=
"
$c_p
name char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
name char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
type enum('function','procedure') NOT NULL,"
c_p
=
"
$c_p
type enum('function','procedure') NOT NULL,"
c_p
=
"
$c_p
body blob DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
body blob DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
creator char(77) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
created timestamp,"
c_p
=
"
$c_p
modified timestamp,"
c_p
=
"
$c_p
suid enum ('N', 'Y') DEFAULT 'Y' NOT NULL,"
c_p
=
"
$c_p
comment char(64) binary DEFAULT '' NOT NULL,"
c_p
=
"
$c_p
PRIMARY KEY (name,type)"
c_p
=
"
$c_p
PRIMARY KEY (name,type)"
c_p
=
"
$c_p
)"
c_p
=
"
$c_p
)"
c_p
=
"
$c_p
comment='Stored Procedures';"
c_p
=
"
$c_p
comment='Stored Procedures';"
...
...
sql/sp.cc
View file @
33cabdc3
...
@@ -93,6 +93,14 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
...
@@ -93,6 +93,14 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
const
char
*
defstr
;
const
char
*
defstr
;
int
ret
;
int
ret
;
bool
opened
;
bool
opened
;
const
char
*
creator
;
longlong
created
;
longlong
modified
;
bool
suid
=
1
;
char
*
ptr
;
uint
length
;
char
buff
[
65
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
// QQ Set up our own mem_root here???
// QQ Set up our own mem_root here???
ret
=
db_find_routine_aux
(
thd
,
type
,
name
,
namelen
,
TL_READ
,
&
table
,
&
opened
);
ret
=
db_find_routine_aux
(
thd
,
type
,
name
,
namelen
,
TL_READ
,
&
table
,
&
opened
);
...
@@ -103,6 +111,35 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
...
@@ -103,6 +111,35 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
ret
=
SP_GET_FIELD_FAILED
;
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
goto
done
;
}
}
//Get additional information
if
((
creator
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
3
]))
==
NULL
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
created
=
table
->
field
[
4
]
->
val_int
();
modified
=
table
->
field
[
5
]
->
val_int
();
if
((
ptr
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
6
]))
==
NULL
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
if
(
ptr
[
0
]
==
'N'
)
suid
=
0
;
table
->
field
[
7
]
->
val_str
(
&
str
,
&
str
);
length
=
str
.
length
();
ptr
=
0
;
if
(
length
)
{
ptr
=
(
char
*
)
alloc_root
(
&
thd
->
mem_root
,
length
+
1
);
memcpy
(
ptr
,
str
.
ptr
(),(
uint
)
length
);
ptr
[
length
]
=
0
;
}
if
(
opened
)
if
(
opened
)
{
{
close_thread_tables
(
thd
,
0
,
1
);
close_thread_tables
(
thd
,
0
,
1
);
...
@@ -113,7 +150,12 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
...
@@ -113,7 +150,12 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
if
(
yyparse
(
thd
)
||
thd
->
is_fatal_error
||
tmplex
->
sphead
==
NULL
)
if
(
yyparse
(
thd
)
||
thd
->
is_fatal_error
||
tmplex
->
sphead
==
NULL
)
ret
=
SP_PARSE_ERROR
;
ret
=
SP_PARSE_ERROR
;
else
else
{
*
sphp
=
tmplex
->
sphead
;
*
sphp
=
tmplex
->
sphead
;
(
*
sphp
)
->
sp_set_info
((
char
*
)
creator
,
(
uint
)
strlen
(
creator
),
created
,
modified
,
suid
,
ptr
,
length
);
}
done:
done:
if
(
table
&&
opened
)
if
(
table
&&
opened
)
...
@@ -123,13 +165,15 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
...
@@ -123,13 +165,15 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
static
int
static
int
db_create_routine
(
THD
*
thd
,
int
type
,
db_create_routine
(
THD
*
thd
,
int
type
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
)
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
,
char
*
comment
,
uint
commentlen
,
bool
suid
)
{
{
DBUG_ENTER
(
"db_create_routine"
);
DBUG_ENTER
(
"db_create_routine"
);
DBUG_PRINT
(
"enter"
,
(
"type: %d name: %*s def: %*s"
,
type
,
namelen
,
name
,
deflen
,
def
));
DBUG_PRINT
(
"enter"
,
(
"type: %d name: %*s def: %*s"
,
type
,
namelen
,
name
,
deflen
,
def
));
int
ret
;
int
ret
;
TABLE
*
table
;
TABLE
*
table
;
TABLE_LIST
tables
;
TABLE_LIST
tables
;
char
creator
[
HOSTNAME_LENGTH
+
USERNAME_LENGTH
+
2
];
memset
(
&
tables
,
0
,
sizeof
(
tables
));
memset
(
&
tables
,
0
,
sizeof
(
tables
));
tables
.
db
=
(
char
*
)
"mysql"
;
tables
.
db
=
(
char
*
)
"mysql"
;
...
@@ -140,10 +184,16 @@ db_create_routine(THD *thd, int type,
...
@@ -140,10 +184,16 @@ db_create_routine(THD *thd, int type,
else
else
{
{
restore_record
(
table
,
2
);
// Get default values for fields
restore_record
(
table
,
2
);
// Get default values for fields
strxmov
(
creator
,
thd
->
user
,
"@"
,
thd
->
host_or_ip
,
NullS
);
table
->
field
[
0
]
->
store
(
name
,
namelen
,
system_charset_info
);
table
->
field
[
0
]
->
store
(
name
,
namelen
,
system_charset_info
);
table
->
field
[
1
]
->
store
((
longlong
)
type
);
table
->
field
[
1
]
->
store
((
longlong
)
type
);
table
->
field
[
2
]
->
store
(
def
,
deflen
,
system_charset_info
);
table
->
field
[
2
]
->
store
(
def
,
deflen
,
system_charset_info
);
table
->
field
[
3
]
->
store
(
creator
,
(
uint
)
strlen
(
creator
),
system_charset_info
);
if
(
suid
)
table
->
field
[
6
]
->
store
((
longlong
)
suid
);
if
(
comment
)
table
->
field
[
7
]
->
store
(
comment
,
commentlen
,
system_charset_info
);
if
(
table
->
file
->
write_row
(
table
->
record
[
0
]))
if
(
table
->
file
->
write_row
(
table
->
record
[
0
]))
ret
=
SP_WRITE_ROW_FAILED
;
ret
=
SP_WRITE_ROW_FAILED
;
...
@@ -199,13 +249,15 @@ sp_find_procedure(THD *thd, LEX_STRING *name)
...
@@ -199,13 +249,15 @@ sp_find_procedure(THD *thd, LEX_STRING *name)
}
}
int
int
sp_create_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
)
sp_create_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
,
char
*
comment
,
uint
commentlen
,
bool
suid
)
{
{
DBUG_ENTER
(
"sp_create_procedure"
);
DBUG_ENTER
(
"sp_create_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s def: %*s"
,
namelen
,
name
,
deflen
,
def
));
DBUG_PRINT
(
"enter"
,
(
"name: %*s def: %*s"
,
namelen
,
name
,
deflen
,
def
));
int
ret
;
int
ret
;
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
,
def
,
deflen
);
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
,
def
,
deflen
,
comment
,
commentlen
,
suid
);
DBUG_RETURN
(
ret
);
DBUG_RETURN
(
ret
);
}
}
...
@@ -248,13 +300,15 @@ sp_find_function(THD *thd, LEX_STRING *name)
...
@@ -248,13 +300,15 @@ sp_find_function(THD *thd, LEX_STRING *name)
}
}
int
int
sp_create_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
)
sp_create_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
,
char
*
comment
,
uint
commentlen
,
bool
suid
)
{
{
DBUG_ENTER
(
"sp_create_function"
);
DBUG_ENTER
(
"sp_create_function"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s def: %*s"
,
namelen
,
name
,
deflen
,
def
));
DBUG_PRINT
(
"enter"
,
(
"name: %*s def: %*s"
,
namelen
,
name
,
deflen
,
def
));
int
ret
;
int
ret
;
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
,
def
,
deflen
);
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
,
def
,
deflen
,
comment
,
commentlen
,
suid
);
DBUG_RETURN
(
ret
);
DBUG_RETURN
(
ret
);
}
}
...
...
sql/sp.h
View file @
33cabdc3
...
@@ -31,7 +31,8 @@ sp_head *
...
@@ -31,7 +31,8 @@ sp_head *
sp_find_procedure
(
THD
*
thd
,
LEX_STRING
*
name
);
sp_find_procedure
(
THD
*
thd
,
LEX_STRING
*
name
);
int
int
sp_create_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
);
sp_create_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
,
char
*
comment
,
uint
commentlen
,
bool
suid
);
int
int
sp_drop_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
);
sp_drop_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
);
...
@@ -41,7 +42,8 @@ sp_head *
...
@@ -41,7 +42,8 @@ sp_head *
sp_find_function
(
THD
*
thd
,
LEX_STRING
*
name
);
sp_find_function
(
THD
*
thd
,
LEX_STRING
*
name
);
int
int
sp_create_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
);
sp_create_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
,
char
*
comment
,
uint
commentlen
,
bool
suid
);
int
int
sp_drop_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
);
sp_drop_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
);
...
...
sql/sp_head.cc
View file @
33cabdc3
...
@@ -91,7 +91,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
...
@@ -91,7 +91,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
DBUG_RETURN
(
it
);
DBUG_RETURN
(
it
);
}
}
sp_head
::
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
)
sp_head
::
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
)
:
Sql_alloc
(),
m_simple_case
(
FALSE
),
m_multi_query
(
FALSE
)
:
Sql_alloc
(),
m_simple_case
(
FALSE
),
m_multi_query
(
FALSE
)
{
{
DBUG_ENTER
(
"sp_head::sp_head"
);
DBUG_ENTER
(
"sp_head::sp_head"
);
...
@@ -102,6 +102,16 @@ sp_head::sp_head(LEX_STRING *name, LEX *lex)
...
@@ -102,6 +102,16 @@ sp_head::sp_head(LEX_STRING *name, LEX *lex)
m_name
.
str
=
name
->
str
;
m_name
.
str
=
name
->
str
;
m_defstr
.
length
=
lex
->
end_of_query
-
lex
->
buf
;
m_defstr
.
length
=
lex
->
end_of_query
-
lex
->
buf
;
m_defstr
.
str
=
sql_strmake
(
dstr
,
m_defstr
.
length
);
m_defstr
.
str
=
sql_strmake
(
dstr
,
m_defstr
.
length
);
m_comment
.
length
=
0
;
m_comment
.
str
=
0
;
if
(
comment
)
{
m_comment
.
length
=
comment
->
length
;
m_comment
.
str
=
comment
->
str
;
}
m_suid
=
suid
;
m_pcont
=
lex
->
spcont
;
m_pcont
=
lex
->
spcont
;
my_init_dynamic_array
(
&
m_instr
,
sizeof
(
sp_instr
*
),
16
,
8
);
my_init_dynamic_array
(
&
m_instr
,
sizeof
(
sp_instr
*
),
16
,
8
);
m_backpatch
.
empty
();
m_backpatch
.
empty
();
...
@@ -119,11 +129,15 @@ sp_head::create(THD *thd)
...
@@ -119,11 +129,15 @@ sp_head::create(THD *thd)
if
(
m_type
==
TYPE_ENUM_FUNCTION
)
if
(
m_type
==
TYPE_ENUM_FUNCTION
)
ret
=
sp_create_function
(
thd
,
ret
=
sp_create_function
(
thd
,
m_name
.
str
,
m_name
.
length
,
m_name
.
str
,
m_name
.
length
,
m_defstr
.
str
,
m_defstr
.
length
);
m_defstr
.
str
,
m_defstr
.
length
,
m_comment
.
str
,
m_comment
.
length
,
m_suid
);
else
else
ret
=
sp_create_procedure
(
thd
,
ret
=
sp_create_procedure
(
thd
,
m_name
.
str
,
m_name
.
length
,
m_name
.
str
,
m_name
.
length
,
m_defstr
.
str
,
m_defstr
.
length
);
m_defstr
.
str
,
m_defstr
.
length
,
m_comment
.
str
,
m_comment
.
length
,
m_suid
);
DBUG_RETURN
(
ret
);
DBUG_RETURN
(
ret
);
}
}
...
...
sql/sp_head.h
View file @
33cabdc3
...
@@ -54,7 +54,7 @@ class sp_head : public Sql_alloc
...
@@ -54,7 +54,7 @@ class sp_head : public Sql_alloc
List<char *> m_tables; // Used tables.
List<char *> m_tables; // Used tables.
#endif
#endif
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
);
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
);
int
int
create
(
THD
*
thd
);
create
(
THD
*
thd
);
...
@@ -111,10 +111,30 @@ class sp_head : public Sql_alloc
...
@@ -111,10 +111,30 @@ class sp_head : public Sql_alloc
return
sp_map_result_type
(
m_returns
);
return
sp_map_result_type
(
m_returns
);
}
}
void
sp_set_info
(
char
*
creator
,
uint
creatorlen
,
longlong
created
,
longlong
modified
,
bool
suid
,
char
*
comment
,
uint
commentlen
)
{
m_creator
=
creator
;
m_creatorlen
=
creatorlen
;
m_created
=
created
;
m_modified
=
modified
;
m_comment
.
length
=
commentlen
;
m_comment
.
str
=
comment
;
m_suid
=
suid
;
}
private:
private:
LEX_STRING
m_name
;
LEX_STRING
m_name
;
LEX_STRING
m_defstr
;
LEX_STRING
m_defstr
;
LEX_STRING
m_comment
;
char
*
m_creator
;
uint
m_creatorlen
;
longlong
m_created
;
longlong
m_modified
;
bool
m_suid
;
sp_pcontext
*
m_pcont
;
// Parse context
sp_pcontext
*
m_pcont
;
// Parse context
LEX
m_lex
;
// Temp. store for the other lex
LEX
m_lex
;
// Temp. store for the other lex
DYNAMIC_ARRAY
m_instr
;
// The "instructions"
DYNAMIC_ARRAY
m_instr
;
// The "instructions"
...
...
sql/sql_yacc.yy
View file @
33cabdc3
...
@@ -938,7 +938,7 @@ create:
...
@@ -938,7 +938,7 @@ create:
YYABORT;
YYABORT;
}
}
lex->spcont= new sp_pcontext();
lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&$3, lex);
lex->sphead= new sp_head(&$3, lex
, 0, 0
);
lex->sphead->m_type= TYPE_ENUM_PROCEDURE;
lex->sphead->m_type= TYPE_ENUM_PROCEDURE;
/*
/*
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
...
@@ -987,7 +987,7 @@ create_function_tail:
...
@@ -987,7 +987,7 @@ create_function_tail:
YYABORT;
YYABORT;
}
}
lex->spcont= new sp_pcontext();
lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&lex->udf.name, lex);
lex->sphead= new sp_head(&lex->udf.name, lex
, 0, 0
);
lex->sphead->m_type= TYPE_ENUM_FUNCTION;
lex->sphead->m_type= TYPE_ENUM_FUNCTION;
/*
/*
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
...
...
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