1 /* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef SQL_IMPORT_INCLUDED
24 #define SQL_IMPORT_INCLUDED
25 
26 #include "lex_string.h"
27 #include "my_sqlcommand.h"
28 #include "sql/mem_root_array.h"
29 #include "sql/sql_cmd.h"  // Sql_cmd
30 
31 class THD;
32 
33 /**
34   @file sql/sql_import.h Declaration of command class for the IMPORT TABLES
35   command.
36  */
37 
38 /**
39   Command class for the IMPORT command.
40  */
41 class Sql_cmd_import_table : public Sql_cmd {
42   typedef Mem_root_array_YY<LEX_STRING> Sdi_patterns_type;
43   const Sdi_patterns_type m_sdi_patterns;
44 
45  public:
46   /**
47     Called by sql_yacc.yy.
48 
49     @param patterns - Mem_root_array_YY of all the sdi file patterns
50     provided as arguments.
51    */
52   Sql_cmd_import_table(const Sdi_patterns_type &patterns);
53 
54   /**
55     Import tables from SDI files or patterns provided to constructor.
56     @param thd - thread handle
57     @retval true on error
58     @retval false otherwise
59  */
60   virtual bool execute(THD *thd);
61 
62   /**
63     Provide access to the command code enum value.
64     @return command code enum value
65    */
66   virtual enum_sql_command sql_command_code() const;
67 };
68 #endif /* !SQL_IMPORT_INCLUDED */
69