1 #ifndef DD_SP_INCLUDED
2 #define DD_SP_INCLUDED
3 /* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License, version 2.0,
7    as published by the Free Software Foundation.
8 
9    This program is also distributed with certain software (including
10    but not limited to OpenSSL) that is licensed under separate terms,
11    as designated in a particular file or component or in included license
12    documentation.  The authors of MySQL hereby grant you an additional
13    permission to link the program and your derivative works with the
14    separately licensed software that they have included with MySQL.
15 
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License, version 2.0, for more details.
20 
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
24 
25 #include "sql/dd/string_type.h"
26 #include "sql/dd/types/routine.h"  // dd::Routine
27 
28 class THD;
29 struct st_sp_chistics;
30 
31 /**
32   Method to prepare sp_chistics object using the dd::Routine object read
33   from the Data Dictionary.
34 
35   @param[in]  routine     Routine object read from the Data Dictionary.
36   @param[out] sp_chistics st_sp_chistics type's object to be prepared from the
37                           routine param.
38 */
39 
40 void prepare_sp_chistics_from_dd_routine(const dd::Routine *routine,
41                                          st_sp_chistics *sp_chistics);
42 
43 /**
44   Helper method to prepare stored routine type in string format using the
45   Routine object read from the Data Dictionary.
46 
47   @param[in]   thd              Thread handle.
48   @param[in]   routine          dd::Routine type object read from the Data
49                                 Dictionary.
50   @param[out]  return_type_str  Stored routine return type in string format.
51 */
52 
53 void prepare_return_type_string_from_dd_routine(
54     THD *thd, const dd::Routine *routine, dd::String_type *return_type_str);
55 
56 /**
57   Method to prepare stored routine's parameter string using the Routine
58   object read from the Data Dictionary.
59 
60   @param[in]   thd              Thread handle.
61   @param[in]   routine          dd::Routine type object read from the Data
62                                 Dictionary.
63   @param[out]  params_str       String prepared from the all the parameters of
64                                 stored routine.
65 */
66 
67 void prepare_params_string_from_dd_routine(THD *thd, const dd::Routine *routine,
68                                            dd::String_type *params_str);
69 
70 /**
71   Method to check whether routine object is of stored function type
72   or not.
73 
74   @param[in]  routine     Routine object read from the Data Dictionary.
75 */
76 
is_dd_routine_type_function(const dd::Routine * routine)77 inline bool is_dd_routine_type_function(const dd::Routine *routine) {
78   return (routine->type() == dd::Routine::RT_FUNCTION);
79 }
80 #endif  // DD_SP_INCLUDED
81