MySQL  8.0.18
Source Code Documentation
sql_exchange.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 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_EXCHANGE_INCLUDED
24 #define SQL_EXCHANGE_INCLUDED
25 
26 struct CHARSET_INFO;
27 class String;
28 
30 
31 /**
32  Helper for the sql_exchange class
33 */
34 
36  const String *line_term;
38 
39  void cleanup() { line_term = line_start = nullptr; }
41  if (s.line_term != nullptr) line_term = s.line_term;
42  if (s.line_start != nullptr) line_start = s.line_start;
43  }
44 };
45 
46 /**
47  Helper for the sql_exchange class
48 */
49 
52  const String *escaped;
53  const String *enclosed;
55 
56  void cleanup() {
57  field_term = escaped = enclosed = nullptr;
58  opt_enclosed = false;
59  }
61  if (s.field_term != nullptr) field_term = s.field_term;
62  if (s.escaped != nullptr) escaped = s.escaped;
63  if (s.enclosed != nullptr) enclosed = s.enclosed;
64  // TODO: a bug?
65  // OPTIONALLY ENCLOSED BY x ENCLOSED BY y == OPTIONALLY ENCLOSED BY y
67  }
68 };
69 
70 /**
71  Used to hold information about file and file structure in exchange
72  via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
73  XXX: We never call destructor for objects of this class.
74 */
75 
77  public:
80  enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
81  const char *file_name;
82  bool dumpfile;
83  unsigned long skip_lines;
84  const CHARSET_INFO *cs;
85  sql_exchange(const char *name, bool dumpfile_flag,
86  enum_filetype filetype_arg = FILETYPE_CSV);
87  bool escaped_given(void);
88 };
89 
90 #endif
Line_separators line
Definition: sql_exchange.h:79
const string name("\ame\)
sql_exchange(const char *name, bool dumpfile_flag, enum_filetype filetype_arg=FILETYPE_CSV)
Definition: query_result.cc:119
bool escaped_given(void)
Definition: query_result.cc:132
void merge_line_separators(const Line_separators &s)
Definition: sql_exchange.h:40
const String * line_term
Definition: sql_exchange.h:36
const char * file_name
Definition: sql_exchange.h:81
const String * enclosed
Definition: sql_exchange.h:53
Used to hold information about file and file structure in exchange via non-DB file (...
Definition: sql_exchange.h:76
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:161
void merge_field_separators(const Field_separators &s)
Definition: sql_exchange.h:60
Definition: sql_exchange.h:29
enum_filetype
Definition: sql_exchange.h:29
unsigned long skip_lines
Definition: sql_exchange.h:83
void cleanup()
Definition: sql_exchange.h:56
const String * field_term
Definition: sql_exchange.h:51
const String * escaped
Definition: sql_exchange.h:52
#define final(a, b, c)
Definition: hash.c:109
bool dumpfile
Definition: sql_exchange.h:82
enum enum_filetype filetype
Definition: sql_exchange.h:80
Definition: m_ctype.h:359
Field_separators field
Definition: sql_exchange.h:78
void cleanup()
Definition: sql_exchange.h:39
Helper for the sql_exchange class.
Definition: sql_exchange.h:50
Definition: sql_exchange.h:29
const CHARSET_INFO * cs
Definition: sql_exchange.h:84
bool opt_enclosed
Definition: sql_exchange.h:54
const String * line_start
Definition: sql_exchange.h:37
Helper for the sql_exchange class.
Definition: sql_exchange.h:35