MySQL 8.0.31
Source Code Documentation
sql_exchange.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2022, Oracle and/or its affiliates.
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
26struct CHARSET_INFO;
27class String;
28
30
31/**
32 Helper for the sql_exchange class
33*/
34
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
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
76class sql_exchange final {
77 public:
80 enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
81 const char *file_name;
83 unsigned long skip_lines;
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
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
Used to hold information about file and file structure in exchange via non-DB file (....
Definition: sql_exchange.h:76
sql_exchange(const char *name, bool dumpfile_flag, enum_filetype filetype_arg=FILETYPE_CSV)
Definition: query_result.cc:126
enum enum_filetype filetype
Definition: sql_exchange.h:80
bool dumpfile
Definition: sql_exchange.h:82
Field_separators field
Definition: sql_exchange.h:78
const char * file_name
Definition: sql_exchange.h:81
bool escaped_given(void)
Definition: query_result.cc:139
const CHARSET_INFO * cs
Definition: sql_exchange.h:84
unsigned long skip_lines
Definition: sql_exchange.h:83
Line_separators line
Definition: sql_exchange.h:79
enum_filetype
Definition: sql_exchange.h:29
@ FILETYPE_CSV
Definition: sql_exchange.h:29
@ FILETYPE_XML
Definition: sql_exchange.h:29
case opt name
Definition: sslopt-case.h:32
Definition: m_ctype.h:382
Helper for the sql_exchange class.
Definition: sql_exchange.h:50
const String * field_term
Definition: sql_exchange.h:51
void merge_field_separators(const Field_separators &s)
Definition: sql_exchange.h:60
const String * enclosed
Definition: sql_exchange.h:53
const String * escaped
Definition: sql_exchange.h:52
void cleanup()
Definition: sql_exchange.h:56
bool opt_enclosed
Definition: sql_exchange.h:54
Helper for the sql_exchange class.
Definition: sql_exchange.h:35
void merge_line_separators(const Line_separators &s)
Definition: sql_exchange.h:40
void cleanup()
Definition: sql_exchange.h:39
const String * line_term
Definition: sql_exchange.h:36
const String * line_start
Definition: sql_exchange.h:37