672
672
if (!my_b_inited(tempfile) &&
673
673
open_cached_file(tempfile, drizzle_tmpdir.c_str(), TEMP_PREFIX, DISK_BUFFER_SIZE,
676
678
/* check we won't have more buffpeks than we can possibly keep in memory */
677
679
if (my_b_tell(buffpek_pointers) + sizeof(buffpek) > (uint64_t)UINT_MAX)
679
684
buffpek.file_pos= my_b_tell(tempfile);
680
685
if ((ha_rows) count > param->max_rows)
681
686
count=(uint32_t) param->max_rows;
682
687
buffpek.count=(ha_rows) count;
683
688
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
684
690
if (my_b_write(tempfile, (unsigned char*) *sort_keys, (uint32_t) rec_length))
686
696
if (my_b_write(buffpek_pointers, (unsigned char*) &buffpek, sizeof(buffpek)))