Last active
September 8, 2016 14:59
-
-
Save gabidavila/e5f55a5314c0bbaefae30c5cd2295c42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy a field part into an output buffer. | |
SYNOPSIS | |
Field::get_key_image() | |
buff [out] output buffer | |
length output buffer size | |
type itMBR for geometry blobs, otherwise itRAW | |
DESCRIPTION | |
This function makes a copy of field part of size equal to or | |
less than "length" parameter value. | |
For fields of string types (CHAR, VARCHAR, TEXT) the rest of buffer | |
is padded by zero byte. | |
NOTES | |
For variable length character fields (i.e. UTF-8) the "length" | |
parameter means a number of output buffer bytes as if all field | |
characters have maximal possible size (mbmaxlen). In the other words, | |
"length" parameter is a number of characters multiplied by | |
field_charset->mbmaxlen. | |
RETURN | |
Number of copied bytes (excluding padded zero bytes -- see above). | |
*/ | |
virtual size_t get_key_image(uchar *buff, size_t length, imagetype type) | |
{ | |
get_image(buff, length, &my_charset_bin); | |
return length; | |
} | |
virtual void set_key_image(const uchar *buff, size_t length) | |
{ set_image(buff,length, &my_charset_bin); } | |
inline longlong val_int_offset(uint row_offset) | |
{ | |
ptr+=row_offset; | |
longlong tmp=val_int(); | |
ptr-=row_offset; | |
return tmp; | |
} | |
inline longlong val_int(const uchar *new_ptr) | |
{ | |
uchar *old_ptr= ptr; | |
longlong return_value; | |
ptr= (uchar*) new_ptr; | |
return_value= val_int(); | |
ptr= old_ptr; | |
return return_value; | |
} | |
inline String *val_str(String *str, const uchar *new_ptr) | |
{ | |
uchar *old_ptr= ptr; | |
ptr= (uchar*) new_ptr; | |
val_str(str); | |
ptr= old_ptr; | |
return str; | |
} | |
virtual bool send_binary(Protocol *protocol); | |
virtual bool send_text(Protocol *protocol); | |
virtual uchar *pack(uchar *to, const uchar *from, | |
uint max_length, bool low_byte_first); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment