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
00420f89
Commit
00420f89
authored
Oct 30, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
parents
fc475dbf
055559bc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
14 deletions
+46
-14
sql/sp.cc
sql/sp.cc
+46
-14
No files found.
sql/sp.cc
View file @
00420f89
...
...
@@ -26,7 +26,17 @@
*
*/
// *opened=true means we opened ourselves
#define MYSQL_PROC_FIELD_NAME 0
#define MYSQL_PROC_FIELD_TYPE 1
#define MYSQL_PROC_FIELD_DEFINITION 2
#define MYSQL_PROC_FIELD_CREATOR 3
#define MYSQL_PROC_FIELD_MODIFIED 4
#define MYSQL_PROC_FIELD_CREATED 5
#define MYSQL_PROC_FIELD_SUID 6
#define MYSQL_PROC_FIELD_COMMENT 7
#define MYSQL_PROC_FIELD_COUNT 8
/* *opened=true means we opened ourselves */
static
int
db_find_routine_aux
(
THD
*
thd
,
int
type
,
char
*
name
,
uint
namelen
,
enum
thr_lock_type
ltype
,
TABLE
**
tablep
,
bool
*
opened
)
...
...
@@ -102,23 +112,33 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
ret
=
db_find_routine_aux
(
thd
,
type
,
name
,
namelen
,
TL_READ
,
&
table
,
&
opened
);
if
(
ret
!=
SP_OK
)
goto
done
;
if
((
defstr
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
2
]))
==
NULL
)
if
(
table
->
fields
!=
MYSQL_PROC_FIELD_COUNT
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
if
((
defstr
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
MYSQL_PROC_FIELD_DEFINITION
]))
==
NULL
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
// Get additional information
if
((
creator
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
3
]))
==
NULL
)
if
((
creator
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
MYSQL_PROC_FIELD_CREATOR
]))
==
NULL
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
modified
=
table
->
field
[
4
]
->
val_int
();
created
=
table
->
field
[
5
]
->
val_int
();
modified
=
table
->
field
[
MYSQL_PROC_FIELD_MODIFIED
]
->
val_int
();
created
=
table
->
field
[
MYSQL_PROC_FIELD_CREATED
]
->
val_int
();
if
((
ptr
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
6
]))
==
NULL
)
if
((
ptr
=
get_field
(
&
thd
->
mem_root
,
table
->
field
[
MYSQL_PROC_FIELD_SUID
]))
==
NULL
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
...
...
@@ -126,7 +146,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
if
(
ptr
[
0
]
==
'N'
)
suid
=
0
;
table
->
field
[
7
]
->
val_str
(
&
str
,
&
str
);
table
->
field
[
MYSQL_PROC_FIELD_COMMENT
]
->
val_str
(
&
str
,
&
str
);
ptr
=
0
;
if
((
length
=
str
.
length
()))
ptr
=
strmake_root
(
&
thd
->
mem_root
,
str
.
ptr
(),
length
);
...
...
@@ -195,15 +216,25 @@ db_create_routine(THD *thd, int type,
restore_record
(
table
,
default_values
);
// 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
[
1
]
->
store
((
longlong
)
type
);
table
->
field
[
2
]
->
store
(
def
,
deflen
,
system_charset_info
);
table
->
field
[
3
]
->
store
(
creator
,
(
uint
)
strlen
(
creator
),
system_charset_info
);
((
Field_timestamp
*
)
table
->
field
[
5
])
->
set_time
();
if
(
table
->
fields
!=
MYSQL_PROC_FIELD_COUNT
)
{
ret
=
SP_GET_FIELD_FAILED
;
goto
done
;
}
table
->
field
[
MYSQL_PROC_FIELD_NAME
]
->
store
(
name
,
namelen
,
system_charset_info
);
table
->
field
[
MYSQL_PROC_FIELD_TYPE
]
->
store
((
longlong
)
type
);
table
->
field
[
MYSQL_PROC_FIELD_DEFINITION
]
->
store
(
def
,
deflen
,
system_charset_info
);
table
->
field
[
MYSQL_PROC_FIELD_CREATOR
]
->
store
(
creator
,
(
uint
)
strlen
(
creator
),
system_charset_info
);
((
Field_timestamp
*
)
table
->
field
[
MYSQL_PROC_FIELD_CREATED
])
->
set_time
();
if
(
suid
)
table
->
field
[
6
]
->
store
((
longlong
)
suid
);
table
->
field
[
MYSQL_PROC_FIELD_SUID
]
->
store
((
longlong
)
suid
);
if
(
comment
)
table
->
field
[
7
]
->
store
(
comment
,
commentlen
,
system_charset_info
);
table
->
field
[
MYSQL_PROC_FIELD_COMMENT
]
->
store
(
comment
,
commentlen
,
system_charset_info
);
if
(
table
->
file
->
write_row
(
table
->
record
[
0
]))
ret
=
SP_WRITE_ROW_FAILED
;
...
...
@@ -211,6 +242,7 @@ db_create_routine(THD *thd, int type,
ret
=
SP_OK
;
}
done:
close_thread_tables
(
thd
);
DBUG_RETURN
(
ret
);
}
...
...
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