85
87
void set_io_cache_arg(void* arg) { cache.arg = arg; }
88
static int read_fixed_length(Session *session, COPY_INFO &info, TableList *table_list,
90
static int read_fixed_length(Session *session, CopyInfo &info, TableList *table_list,
89
91
List<Item> &fields_vars, List<Item> &set_fields,
90
92
List<Item> &set_values, READ_INFO &read_info,
91
93
uint32_t skip_lines,
92
94
bool ignore_check_option_errors);
93
static int read_sep_field(Session *session, COPY_INFO &info, TableList *table_list,
95
static int read_sep_field(Session *session, CopyInfo &info, TableList *table_list,
94
96
List<Item> &fields_vars, List<Item> &set_fields,
95
97
List<Item> &set_values, READ_INFO &read_info,
96
98
String &enclosed, uint32_t skip_lines,
178
180
if (!fields_vars.elements)
181
for (field=table->field; *field ; field++)
183
for (field= table->getFields(); *field ; field++)
182
184
fields_vars.push_back(new Item_field(*field));
183
185
table->setWriteSet();
184
186
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
259
261
if (!internal::dirname_length(ex->file_name))
261
strcpy(name, drizzle_real_data_home);
262
strncat(name, tdb, FN_REFLEN-strlen(drizzle_real_data_home)-1);
263
strcpy(name, getDataHomeCatalog().c_str());
264
strncat(name, "/", 1);
265
strncat(name, tdb, FN_REFLEN-getDataHomeCatalog().size());
263
266
(void) internal::fn_format(name, ex->file_name, name, "",
264
267
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
268
(void) internal::fn_format(name, ex->file_name, drizzle_real_data_home, "",
271
(void) internal::fn_format(name, ex->file_name, getDataHomeCatalog().c_str(), "",
269
272
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
271
if (opt_secure_file_priv &&
272
strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
274
if (opt_secure_file_priv)
274
/* Read only allowed from within dir specified by secure_file_priv */
275
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
276
fs::path secure_file_path(fs::system_complete(fs::path(opt_secure_file_priv)));
277
fs::path target_path(fs::system_complete(fs::path(name)));
278
if (target_path.file_string().substr(0, secure_file_path.file_string().size()) != secure_file_path.file_string())
280
/* Read only allowed from within dir specified by secure_file_priv */
281
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
279
286
struct stat stat_info;
306
313
memset(&info, 0, sizeof(info));
307
314
info.ignore= ignore;
308
315
info.handle_duplicates=handle_duplicates;
309
316
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
318
SchemaIdentifier identifier(session->db);
311
319
READ_INFO read_info(file, tot_length,
312
ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(session->db.c_str()),
313
*field_term,*ex->line_start, *ex->line_term, *enclosed,
320
ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(identifier),
321
*field_term, *ex->line_start, *ex->line_term, *enclosed,
314
322
info.escape_char, is_fifo);
315
323
if (read_info.error)
376
384
internal::my_close(file,MYF(0));
377
385
free_blobs(table); /* if pack_blob was used */
378
386
table->copy_blobs=0;
379
session->count_cuted_fields= CHECK_FIELD_IGNORE;
387
session->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
381
389
simulated killing in the middle of per-row loop
382
390
must be effective for binlogging
387
395
error= -1; // Error on read
390
sprintf(name, ER(ER_LOAD_INFO), (uint32_t) info.records, (uint32_t) info.deleted,
391
(uint32_t) (info.records - info.copied), (uint32_t) session->cuted_fields);
398
snprintf(name, sizeof(name), ER(ER_LOAD_INFO), info.records, info.deleted,
399
(info.records - info.copied), session->cuted_fields);
393
401
if (session->transaction.stmt.hasModifiedNonTransData())
394
402
session->transaction.all.markModifiedNonTransData();
410
418
****************************************************************************/
413
read_fixed_length(Session *session, COPY_INFO &info, TableList *table_list,
421
read_fixed_length(Session *session, CopyInfo &info, TableList *table_list,
414
422
List<Item> &fields_vars, List<Item> &set_fields,
415
423
List<Item> &set_values, READ_INFO &read_info,
416
424
uint32_t skip_lines, bool ignore_check_option_errors)
532
read_sep_field(Session *session, COPY_INFO &info, TableList *table_list,
540
read_sep_field(Session *session, CopyInfo &info, TableList *table_list,
533
541
List<Item> &fields_vars, List<Item> &set_fields,
534
542
List<Item> &set_values, READ_INFO &read_info,
535
543
String &enclosed, uint32_t skip_lines,