932
932
void Session::add_changed_table(Table *table)
934
934
assert((options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
935
table->cursor->has_transactions());
935
table->file->has_transactions());
936
936
add_changed_table(table->s->table_cache_key.str,
937
937
(long) table->s->table_cache_key.length);
1040
1040
(void) end_io_cache(&cache);
1041
(void) my_close(file, MYF(0));
1042
(void) my_delete(path, MYF(0)); // Delete file on error
1041
(void) my_close(file,MYF(0));
1042
(void) my_delete(path,MYF(0)); // Delete file on error
1260
1260
if (res && enclosed)
1262
1262
if (my_b_write(&cache,(unsigned char*) exchange->enclosed->ptr(),
1263
exchange->enclosed->length()))
1263
exchange->enclosed->length()))
1268
1268
if (!fixed_row_size)
1270
if (escape_char != -1) // Use \N syntax
1272
null_buff[0]=escape_char;
1274
if (my_b_write(&cache,(unsigned char*) null_buff,2))
1277
else if (my_b_write(&cache,(unsigned char*) "NULL",4))
1270
if (escape_char != -1) // Use \N syntax
1272
null_buff[0]=escape_char;
1274
if (my_b_write(&cache,(unsigned char*) null_buff,2))
1277
else if (my_b_write(&cache,(unsigned char*) "NULL",4))
1282
used_length=0; // Fill with space
1282
used_length=0; // Fill with space
1290
1290
used_length= res->length();
1292
1292
if ((result_type == STRING_RESULT || is_unsafe_field_sep) &&
1295
1295
char *pos, *start, *end;
1296
1296
const CHARSET_INFO * const res_charset= res->charset();
1297
1297
const CHARSET_INFO * const character_set_client= default_charset_info;
1299
1299
bool check_second_byte= (res_charset == &my_charset_bin) &&
1300
character_set_client->
1301
escape_with_backslash_is_dangerous;
1300
character_set_client->
1301
escape_with_backslash_is_dangerous;
1302
1302
assert(character_set_client->mbmaxlen == 2 ||
1303
1303
!character_set_client->escape_with_backslash_is_dangerous);
1304
for (start=pos=(char*) res->ptr(),end=pos+used_length ;
1308
if (use_mb(res_charset))
1311
if ((l=my_ismbchar(res_charset, pos, end)))
1304
for (start=pos=(char*) res->ptr(),end=pos+used_length ;
1308
if (use_mb(res_charset))
1311
if ((l=my_ismbchar(res_charset, pos, end)))
1319
1319
Special case when dumping BINARY/VARBINARY/BLOB values
1353
1353
pos + 1 < end &&
1354
1354
NEED_ESCAPING(pos[1]))) &&
1356
Don't escape field_term_char by doubling - doubling is only
1357
valid for ENCLOSED BY characters:
1356
Don't escape field_term_char by doubling - doubling is only
1357
valid for ENCLOSED BY characters:
1359
1359
(enclosed || !is_ambiguous_field_term ||
1360
1360
(int) (unsigned char) *pos != field_term_char))
1363
1363
tmp_buff[0]= ((int) (unsigned char) *pos == field_sep_char &&
1364
1364
is_ambiguous_field_sep) ?
1365
field_sep_char : escape_char;
1366
tmp_buff[1]= *pos ? *pos : '0';
1367
if (my_b_write(&cache,(unsigned char*) start,(uint32_t) (pos-start)) ||
1368
my_b_write(&cache,(unsigned char*) tmp_buff,2))
1373
if (my_b_write(&cache,(unsigned char*) start,(uint32_t) (pos-start)))
1365
field_sep_char : escape_char;
1366
tmp_buff[1]= *pos ? *pos : '0';
1367
if (my_b_write(&cache,(unsigned char*) start,(uint32_t) (pos-start)) ||
1368
my_b_write(&cache,(unsigned char*) tmp_buff,2))
1373
if (my_b_write(&cache,(unsigned char*) start,(uint32_t) (pos-start)))
1376
1376
else if (my_b_write(&cache,(unsigned char*) res->ptr(),used_length))
1379
1379
if (fixed_row_size)
1380
1380
{ // Fill with space
1381
1381
if (item->max_length > used_length)
1383
/* QQ: Fix by adding a my_b_fill() function */
1387
memset(space, ' ', sizeof(space));
1389
uint32_t length=item->max_length-used_length;
1390
for (; length > sizeof(space) ; length-=sizeof(space))
1392
if (my_b_write(&cache,(unsigned char*) space,sizeof(space)))
1395
if (my_b_write(&cache,(unsigned char*) space,length))
1383
/* QQ: Fix by adding a my_b_fill() function */
1387
memset(space, ' ', sizeof(space));
1389
uint32_t length=item->max_length-used_length;
1390
for (; length > sizeof(space) ; length-=sizeof(space))
1392
if (my_b_write(&cache,(unsigned char*) space,sizeof(space)))
1395
if (my_b_write(&cache,(unsigned char*) space,length))
1399
1399
if (res && enclosed)