MySQL 8.0.39
Source Code Documentation
sql_exchange.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SQL_EXCHANGE_INCLUDED
25#define SQL_EXCHANGE_INCLUDED
26
27struct CHARSET_INFO;
28class String;
29
31
33
34/**
35 Helper for the sql_exchange class
36*/
37
41
42 void cleanup() { line_term = line_start = nullptr; }
44 if (s.line_term != nullptr) line_term = s.line_term;
45 if (s.line_start != nullptr) line_start = s.line_start;
46 }
47};
48
49/**
50 Helper for the sql_exchange class
51*/
52
58
59 void cleanup() {
60 field_term = escaped = enclosed = nullptr;
61 opt_enclosed = false;
62 }
64 if (s.field_term != nullptr) field_term = s.field_term;
65 if (s.escaped != nullptr) escaped = s.escaped;
66 if (s.enclosed != nullptr) enclosed = s.enclosed;
67 // TODO: a bug?
68 // OPTIONALLY ENCLOSED BY x ENCLOSED BY y == OPTIONALLY ENCLOSED BY y
70 }
71};
72
73/**
74 Used to hold information about file and file structure in exchange
75 via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
76 XXX: We never call destructor for objects of this class.
77*/
78
79class sql_exchange final {
80 public:
83 enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
84 const char *file_name;
86 unsigned long skip_lines;
88 sql_exchange(const char *name, bool dumpfile_flag,
89 enum_filetype filetype_arg = FILETYPE_CSV);
90 bool escaped_given(void);
91};
92
93#endif
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
Used to hold information about file and file structure in exchange via non-DB file (....
Definition: sql_exchange.h:79
sql_exchange(const char *name, bool dumpfile_flag, enum_filetype filetype_arg=FILETYPE_CSV)
Definition: query_result.cc:127
enum enum_filetype filetype
Definition: sql_exchange.h:83
bool dumpfile
Definition: sql_exchange.h:85
Field_separators field
Definition: sql_exchange.h:81
const char * file_name
Definition: sql_exchange.h:84
bool escaped_given(void)
Definition: query_result.cc:140
const CHARSET_INFO * cs
Definition: sql_exchange.h:87
unsigned long skip_lines
Definition: sql_exchange.h:86
Line_separators line
Definition: sql_exchange.h:82
enum_filetype
Definition: sql_exchange.h:32
@ FILETYPE_CSV
Definition: sql_exchange.h:32
@ FILETYPE_XML
Definition: sql_exchange.h:32
enum_source_type
Definition: sql_exchange.h:30
@ LOAD_SOURCE_S3
Definition: sql_exchange.h:30
@ LOAD_SOURCE_URL
Definition: sql_exchange.h:30
@ LOAD_SOURCE_FILE
Definition: sql_exchange.h:30
case opt name
Definition: sslopt-case.h:33
Definition: m_ctype.h:385
Helper for the sql_exchange class.
Definition: sql_exchange.h:53
const String * field_term
Definition: sql_exchange.h:54
void merge_field_separators(const Field_separators &s)
Definition: sql_exchange.h:63
const String * enclosed
Definition: sql_exchange.h:56
const String * escaped
Definition: sql_exchange.h:55
void cleanup()
Definition: sql_exchange.h:59
bool opt_enclosed
Definition: sql_exchange.h:57
Helper for the sql_exchange class.
Definition: sql_exchange.h:38
void merge_line_separators(const Line_separators &s)
Definition: sql_exchange.h:43
void cleanup()
Definition: sql_exchange.h:42
const String * line_term
Definition: sql_exchange.h:39
const String * line_start
Definition: sql_exchange.h:40