Пример #1
0
ulint process_ibrec(page_t *page, rec_t *rec, table_def_t *table, ulint *offsets) {
	ulint data_size;
	int i;
	// Print trx_id and rollback pointer
	for(i = 0; i < table->fields_count; i++) {
		ulint len;
		byte *field = rec_get_nth_field(rec, offsets, i, &len);
		
		if (table->fields[i].type == FT_INTERNAL){
			if (debug) printf("Field #%i @ %p: length %lu, value: ", i, field, len);
			print_field_value(field, len, &(table->fields[i]));
			if (i < table->fields_count - 1) fprintf(f_result, "\t");
			if (debug) printf("\n");
			}
	}

	// Print table name
	if (debug) {
		printf("Processing record %p from table '%s'\n", rec, table->name);
		rec_print_new(stdout, rec, offsets);
	} else {
		fprintf(f_result, "%s\t", table->name);
	}

	data_size = rec_offs_data_size(offsets);

	for(i = 0; i < table->fields_count; i++) {
		ulint len;
		byte *field = rec_get_nth_field(rec, offsets, i, &len);
		
		if (table->fields[i].type == FT_INTERNAL) continue;
		
		if (debug) printf("Field #%i @ %p: length %lu, value: ", i, field, len);

		if (len == UNIV_SQL_NULL) {
			fprintf(f_result, "NULL");
		} else {
            if (rec_offs_nth_extern(offsets, i)) {
                print_field_value_with_external(field, len, &(table->fields[i]));
                } else {
			        print_field_value(field, len, &(table->fields[i]));
                    }
		    }
		
		if (i < table->fields_count - 1) fprintf(f_result, "\t");
		if (debug) printf("\n");
	}

	fprintf(f_result, "\n");
	return data_size; // point to the next possible record's start
}
Пример #2
0
int stp_do_print(stp_print_context_t* ctx, int level)
{
    char line_fmt[32];
    int bytes = 0;

    memset(ctx->buf, 0, ctx->buf_size);

    snprintf(line_fmt,
             sizeof(line_fmt),
             "%%-%0ds  %%-12s  %%-s\n",
             ctx->max_name_colum_width);

    bytes += print_top(ctx,level,line_fmt);
    for(int i=0; i<ctx->num_field; i++) {
        if(ctx->table[i].is_value) {
            bytes += print_field_value(ctx,
                                       &ctx->table[i],
                                       level+1,
                                       line_fmt);
        } else {
            bytes += print_field_struct(ctx,
                                        &ctx->table[i],
                                        level+1);
        }
    }
    return bytes;
}