php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
mysqlnd_charset.c File Reference
#include "php.h"
#include "mysqlnd.h"
#include "mysqlnd_priv.h"
#include "mysqlnd_debug.h"
#include "mysqlnd_charset.h"

Go to the source code of this file.

Macros

#define ENUMERATE_ENCODINGS_CHARLEN(ENUMERATOR)
 
#define ENUMERATE_ENCODINGS_VALID(ENUMERATOR)
 
#define LOWEST_MB_BIG5   0xA1
 
#define LOWEST_MB_UJIS   0x80
 
#define LOWEST_MB_SJIS   0x80
 
#define LOWEST_MB_EUCKR   0x80
 
#define LOWEST_MB_GB2312   0xA1
 
#define LOWEST_MB_GBK   0x80
 
#define LOWEST_MB_UTF8MB3   0x80
 
#define LOWEST_MB_UCS2   0x00
 
#define LOWEST_MB_EUCJPMS   0x80
 
#define LOWEST_MB_UTF8   0x80
 
#define LOWEST_MB_UTF16   0x00
 
#define LOWEST_MB_UTF32   0x00
 
#define LOWEST_MB_CP932   0x80
 
#define LOWEST_MB_GB18030   0x00
 
#define ENUMERATOR_ENUM(x)
 
#define valid_big5head(c)
 
#define valid_big5tail(c)
 
#define isbig5code(c, d)
 
#define valid_cp932head(c)
 
#define valid_cp932tail(c)
 
#define valid_euckr(c)
 
#define valid_eucjpms(c)
 
#define valid_eucjpms_kata(c)
 
#define valid_eucjpms_ss2(c)
 
#define valid_eucjpms_ss3(c)
 
#define valid_gb2312_head(c)
 
#define valid_gb2312_tail(c)
 
#define valid_gbk_head(c)
 
#define valid_gbk_tail(c)
 
#define valid_sjis_head(c)
 
#define valid_sjis_tail(c)
 
#define valid_ujis(c)
 
#define valid_ujis_kata(c)
 
#define valid_ujis_ss2(c)
 
#define valid_ujis_ss3(c)
 
#define UTF16_HIGH_HEAD(x)
 
#define UTF16_LOW_HEAD(x)
 
#define is_gb18030_odd(c)
 
#define is_gb18030_even_2(c)
 
#define is_gb18030_even_4(c)
 
#define UTF8_MB4   "utf8mb4"
 
#define UTF8_MB3   "utf8"
 
#define ENUMERATOR_DISPATCH(x)
 
#define ENUMERATOR_DISPATCH(x)
 

Enumerations

enum  mysqlnd_encoding_charlen
 
enum  mysqlnd_encoding_valid
 

Functions

PHPAPI const MYSQLND_CHARSETmysqlnd_find_charset_nr (const unsigned int charsetnr)
 
PHPAPI const MYSQLND_CHARSETmysqlnd_find_charset_name (const char *const name)
 
PHPAPI zend_ulong mysqlnd_cset_escape_quotes (const MYSQLND_CHARSET *const cset, char *newstr, const char *escapestr, const size_t escapestr_len)
 
PHPAPI zend_ulong mysqlnd_cset_escape_slashes (const MYSQLND_CHARSET *const cset, char *newstr, const char *escapestr, const size_t escapestr_len)
 
void mysqlnd_charsets_plugin_register (void)
 

Variables

const MYSQLND_CHARSET mysqlnd_charsets []
 

Macro Definition Documentation

◆ ENUMERATE_ENCODINGS_CHARLEN

#define ENUMERATE_ENCODINGS_CHARLEN ( ENUMERATOR)
Value:
ENUMERATOR(mysqlnd_mbcharlen_null) \
ENUMERATOR(mysqlnd_mbcharlen_big5) \
ENUMERATOR(mysqlnd_mbcharlen_ujis) \
ENUMERATOR(mysqlnd_mbcharlen_sjis) \
ENUMERATOR(mysqlnd_mbcharlen_euckr) \
ENUMERATOR(mysqlnd_mbcharlen_gb2312) \
ENUMERATOR(mysqlnd_mbcharlen_gbk) \
ENUMERATOR(mysqlnd_mbcharlen_utf8mb3) \
ENUMERATOR(mysqlnd_mbcharlen_ucs2) \
ENUMERATOR(mysqlnd_mbcharlen_eucjpms) \
ENUMERATOR(mysqlnd_mbcharlen_utf8) \
ENUMERATOR(mysqlnd_mbcharlen_utf16) \
ENUMERATOR(mysqlnd_mbcharlen_utf32) \
ENUMERATOR(mysqlnd_mbcharlen_cp932) \
ENUMERATOR(mysqlnd_mbcharlen_gb18030)

Definition at line 25 of file mysqlnd_charset.c.

◆ ENUMERATE_ENCODINGS_VALID

#define ENUMERATE_ENCODINGS_VALID ( ENUMERATOR)
Value:
ENUMERATOR(check_null) \
ENUMERATOR(check_mb_big5) \
ENUMERATOR(check_mb_ujis) \
ENUMERATOR(check_mb_sjis) \
ENUMERATOR(check_mb_euckr) \
ENUMERATOR(check_mb_gb2312) \
ENUMERATOR(check_mb_gbk) \
ENUMERATOR(check_mb_utf8mb3_valid) \
ENUMERATOR(check_mb_ucs2) \
ENUMERATOR(check_mb_eucjpms) \
ENUMERATOR(check_mb_utf8_valid) \
ENUMERATOR(check_mb_utf16) \
ENUMERATOR(check_mb_utf32) \
ENUMERATOR(check_mb_cp932) \
ENUMERATOR(my_ismbchar_gb18030)

Definition at line 42 of file mysqlnd_charset.c.

◆ ENUMERATOR_DISPATCH [1/2]

#define ENUMERATOR_DISPATCH ( x)
Value:
case x##_id: return x(c);

◆ ENUMERATOR_DISPATCH [2/2]

#define ENUMERATOR_DISPATCH ( x)
Value:
case x##_id: return x(start, end);
buf start
Definition ffi.c:4687
unsigned const char * end
Definition php_ffi.h:51

◆ ENUMERATOR_ENUM

#define ENUMERATOR_ENUM ( x)
Value:
x##_id,

Definition at line 74 of file mysqlnd_charset.c.

◆ is_gb18030_even_2

#define is_gb18030_even_2 ( c)
Value:
((0x40 <= (zend_uchar) (c) && (zend_uchar) (c) <= 0x7E) || (0x80 <= (zend_uchar) (c) && (zend_uchar) (c) <= 0xFE))
unsigned char zend_uchar
Definition zend_types.h:57

Definition at line 495 of file mysqlnd_charset.c.

◆ is_gb18030_even_4

#define is_gb18030_even_4 ( c)
Value:
(0x30 <= (zend_uchar) (c) && (zend_uchar) (c) <= 0x39)

Definition at line 496 of file mysqlnd_charset.c.

◆ is_gb18030_odd

#define is_gb18030_odd ( c)
Value:
(0x81 <= (zend_uchar) (c) && (zend_uchar) (c) <= 0xFE)

Definition at line 494 of file mysqlnd_charset.c.

◆ isbig5code

#define isbig5code ( c,
d )
Value:
(isbig5head(c) && isbig5tail(d))

Definition at line 256 of file mysqlnd_charset.c.

◆ LOWEST_MB_BIG5

#define LOWEST_MB_BIG5   0xA1

Definition at line 59 of file mysqlnd_charset.c.

◆ LOWEST_MB_CP932

#define LOWEST_MB_CP932   0x80

Definition at line 71 of file mysqlnd_charset.c.

◆ LOWEST_MB_EUCJPMS

#define LOWEST_MB_EUCJPMS   0x80

Definition at line 67 of file mysqlnd_charset.c.

◆ LOWEST_MB_EUCKR

#define LOWEST_MB_EUCKR   0x80

Definition at line 62 of file mysqlnd_charset.c.

◆ LOWEST_MB_GB18030

#define LOWEST_MB_GB18030   0x00

Definition at line 72 of file mysqlnd_charset.c.

◆ LOWEST_MB_GB2312

#define LOWEST_MB_GB2312   0xA1

Definition at line 63 of file mysqlnd_charset.c.

◆ LOWEST_MB_GBK

#define LOWEST_MB_GBK   0x80

Definition at line 64 of file mysqlnd_charset.c.

◆ LOWEST_MB_SJIS

#define LOWEST_MB_SJIS   0x80

Definition at line 61 of file mysqlnd_charset.c.

◆ LOWEST_MB_UCS2

#define LOWEST_MB_UCS2   0x00

Definition at line 66 of file mysqlnd_charset.c.

◆ LOWEST_MB_UJIS

#define LOWEST_MB_UJIS   0x80

Definition at line 60 of file mysqlnd_charset.c.

◆ LOWEST_MB_UTF16

#define LOWEST_MB_UTF16   0x00

Definition at line 69 of file mysqlnd_charset.c.

◆ LOWEST_MB_UTF32

#define LOWEST_MB_UTF32   0x00

Definition at line 70 of file mysqlnd_charset.c.

◆ LOWEST_MB_UTF8

#define LOWEST_MB_UTF8   0x80

Definition at line 68 of file mysqlnd_charset.c.

◆ LOWEST_MB_UTF8MB3

#define LOWEST_MB_UTF8MB3   0x80

Definition at line 65 of file mysqlnd_charset.c.

◆ UTF16_HIGH_HEAD

#define UTF16_HIGH_HEAD ( x)
Value:
((((zend_uchar) (x)) & 0xFC) == 0xD8)

Definition at line 452 of file mysqlnd_charset.c.

◆ UTF16_LOW_HEAD

#define UTF16_LOW_HEAD ( x)
Value:
((((zend_uchar) (x)) & 0xFC) == 0xDC)

Definition at line 453 of file mysqlnd_charset.c.

◆ UTF8_MB3

#define UTF8_MB3   "utf8"

Definition at line 541 of file mysqlnd_charset.c.

◆ UTF8_MB4

#define UTF8_MB4   "utf8mb4"

Definition at line 540 of file mysqlnd_charset.c.

◆ valid_big5head

#define valid_big5head ( c)
Value:
(0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xF9)

Definition at line 252 of file mysqlnd_charset.c.

◆ valid_big5tail

#define valid_big5tail ( c)
Value:
((0x40 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0x7E) || \
(0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xFE))

Definition at line 253 of file mysqlnd_charset.c.

◆ valid_cp932head

#define valid_cp932head ( c)
Value:
((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) && c <= 0xFC))

Definition at line 272 of file mysqlnd_charset.c.

◆ valid_cp932tail

#define valid_cp932tail ( c)
Value:
((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) && c <= 0xFC))

Definition at line 273 of file mysqlnd_charset.c.

◆ valid_eucjpms

#define valid_eucjpms ( c)
Value:
(((c) & 0xFF) >= 0xA1 && ((c) & 0xFF) <= 0xFE)

Definition at line 316 of file mysqlnd_charset.c.

◆ valid_eucjpms_kata

#define valid_eucjpms_kata ( c)
Value:
(((c) & 0xFF) >= 0xA1 && ((c) & 0xFF) <= 0xDF)

Definition at line 317 of file mysqlnd_charset.c.

◆ valid_eucjpms_ss2

#define valid_eucjpms_ss2 ( c)
Value:
(((c) & 0xFF) == 0x8E)

Definition at line 318 of file mysqlnd_charset.c.

◆ valid_eucjpms_ss3

#define valid_eucjpms_ss3 ( c)
Value:
(((c) & 0xFF) == 0x8F)

Definition at line 319 of file mysqlnd_charset.c.

◆ valid_euckr

#define valid_euckr ( c)
Value:
((0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xFE))

Definition at line 291 of file mysqlnd_charset.c.

◆ valid_gb2312_head

#define valid_gb2312_head ( c)
Value:
(0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xF7)

Definition at line 354 of file mysqlnd_charset.c.

◆ valid_gb2312_tail

#define valid_gb2312_tail ( c)
Value:
(0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xFE)

Definition at line 355 of file mysqlnd_charset.c.

◆ valid_gbk_head

#define valid_gbk_head ( c)
Value:
(0x81<=(zend_uchar)(c) && (zend_uchar)(c)<=0xFE)

Definition at line 373 of file mysqlnd_charset.c.

◆ valid_gbk_tail

#define valid_gbk_tail ( c)
Value:
((0x40<=(zend_uchar)(c) && (zend_uchar)(c)<=0x7E) || (0x80<=(zend_uchar)(c) && (zend_uchar)(c)<=0xFE))

Definition at line 374 of file mysqlnd_charset.c.

◆ valid_sjis_head

#define valid_sjis_head ( c)
Value:
((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) && (c) <= 0xFC))

Definition at line 389 of file mysqlnd_charset.c.

◆ valid_sjis_tail

#define valid_sjis_tail ( c)
Value:
((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) && (c) <= 0xFC))

Definition at line 390 of file mysqlnd_charset.c.

◆ valid_ujis

#define valid_ujis ( c)
Value:
((0xA1 <= ((c)&0xFF) && ((c)&0xFF) <= 0xFE))

Definition at line 420 of file mysqlnd_charset.c.

◆ valid_ujis_kata

#define valid_ujis_kata ( c)
Value:
((0xA1 <= ((c)&0xFF) && ((c)&0xFF) <= 0xDF))

Definition at line 421 of file mysqlnd_charset.c.

◆ valid_ujis_ss2

#define valid_ujis_ss2 ( c)
Value:
(((c)&0xFF) == 0x8E)

Definition at line 422 of file mysqlnd_charset.c.

◆ valid_ujis_ss3

#define valid_ujis_ss3 ( c)
Value:
(((c)&0xFF) == 0x8F)

Definition at line 423 of file mysqlnd_charset.c.

Enumeration Type Documentation

◆ mysqlnd_encoding_charlen

Definition at line 75 of file mysqlnd_charset.c.

◆ mysqlnd_encoding_valid

Definition at line 78 of file mysqlnd_charset.c.

Function Documentation

◆ mysqlnd_charsets_plugin_register()

void mysqlnd_charsets_plugin_register ( void )

Definition at line 1000 of file mysqlnd_charset.c.

◆ mysqlnd_cset_escape_quotes()

PHPAPI zend_ulong mysqlnd_cset_escape_quotes ( const MYSQLND_CHARSET *const cset,
char * newstr,
const char * escapestr,
const size_t escapestr_len )

Definition at line 866 of file mysqlnd_charset.c.

◆ mysqlnd_cset_escape_slashes()

PHPAPI zend_ulong mysqlnd_cset_escape_slashes ( const MYSQLND_CHARSET *const cset,
char * newstr,
const char * escapestr,
const size_t escapestr_len )

Definition at line 905 of file mysqlnd_charset.c.

◆ mysqlnd_find_charset_name()

PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name ( const char *const name)

Definition at line 850 of file mysqlnd_charset.c.

◆ mysqlnd_find_charset_nr()

PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr ( const unsigned int charsetnr)

Definition at line 834 of file mysqlnd_charset.c.

Variable Documentation

◆ mysqlnd_charsets

const MYSQLND_CHARSET mysqlnd_charsets[]

Definition at line 576 of file mysqlnd_charset.c.