MySQL Forums
Forum List  »  General

How to understand the internal record format in mysql
Posted by: shengyun yao
Date: March 26, 2020 01:10AM

I want to know how the internal record fromat in mysql.

For example, in `int handler::write_row(uchar *buf)` function, I can get the value of one int field like this:
```
// i is the index num of the int field in field array
table->s->field->val_int();
```
Another way is get the value from buf like this:
```
ulong offset = (ulong)(field->ptr - table->record[0]);
table->s->field->val_int(buf + offset);
```
So, what are the difference and what situation is the two methods used in? Besides, I can see `uchar *record[2]; `in class `TABLE`. So what is the relation between record and the `buf` in `int handler::write_row(uchar *buf)` (I guess `record[0]` is the same with `buf`, am I right?). And what is the relation between `record[0]` and `record[1]`.

Anybody help me?

Options: ReplyQuote


Subject
Written By
Posted
How to understand the internal record format in mysql
March 26, 2020 01:10AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.