MySQL 8.3.0
Source Code Documentation
sql_exchange.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2023, 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
32
33/**
34 Helper for the sql_exchange class
35*/
36
40
41 void cleanup() { line_term = line_start = nullptr; }
43 if (s.line_term != nullptr) line_term = s.line_term;
44 if (s.line_start != nullptr) line_start = s.line_start;
45 }
46};
47
48/**
49 Helper for the sql_exchange class
50*/
51
57
58 void cleanup() {
59 field_term = escaped = enclosed = nullptr;
60 opt_enclosed = false;
61 }
63 if (s.field_term != nullptr) field_term = s.field_term;
64 if (s.escaped != nullptr) escaped = s.escaped;
65 if (s.enclosed != nullptr) enclosed = s.enclosed;
66 // TODO: a bug?
67 // OPTIONALLY ENCLOSED BY x ENCLOSED BY y == OPTIONALLY ENCLOSED BY y
69 }
70};
71
72/**
73 Used to hold information about file and file structure in exchange
74 via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
75 XXX: We never call destructor for objects of this class.
76*/
77
78class sql_exchange final {
79 public:
82 enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
83 const char *file_name;
85 unsigned long skip_lines;
87 sql_exchange(const char *name, bool dumpfile_flag,
88 enum_filetype filetype_arg = FILETYPE_CSV);
89 bool escaped_given(void);
90};
91
92#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:78
sql_exchange(const char *name, bool dumpfile_flag, enum_filetype filetype_arg=FILETYPE_CSV)
Definition: query_result.cc:128
enum enum_filetype filetype
Definition: sql_exchange.h:82
bool dumpfile
Definition: sql_exchange.h:84
Field_separators field
Definition: sql_exchange.h:80
const char * file_name
Definition: sql_exchange.h:83
bool escaped_given(void)
Definition: query_result.cc:141
const CHARSET_INFO * cs
Definition: sql_exchange.h:86
unsigned long skip_lines
Definition: sql_exchange.h:85
Line_separators line
Definition: sql_exchange.h:81
enum_filetype
Definition: sql_exchange.h:31
@ FILETYPE_CSV
Definition: sql_exchange.h:31
@ FILETYPE_XML
Definition: sql_exchange.h:31
enum_source_type
Definition: sql_exchange.h:29
@ LOAD_SOURCE_S3
Definition: sql_exchange.h:29
@ LOAD_SOURCE_URL
Definition: sql_exchange.h:29
@ LOAD_SOURCE_FILE
Definition: sql_exchange.h:29
case opt name
Definition: sslopt-case.h:32
Definition: m_ctype.h:422
Helper for the sql_exchange class.
Definition: sql_exchange.h:52
const String * field_term
Definition: sql_exchange.h:53
void merge_field_separators(const Field_separators &s)
Definition: sql_exchange.h:62
const String * enclosed
Definition: sql_exchange.h:55
const String * escaped
Definition: sql_exchange.h:54
void cleanup()
Definition: sql_exchange.h:58
bool opt_enclosed
Definition: sql_exchange.h:56
Helper for the sql_exchange class.
Definition: sql_exchange.h:37
void merge_line_separators(const Line_separators &s)
Definition: sql_exchange.h:42
void cleanup()
Definition: sql_exchange.h:41
const String * line_term
Definition: sql_exchange.h:38
const String * line_start
Definition: sql_exchange.h:39