diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-05-29 17:28:12 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-05-29 17:28:12 +0000 |
commit | afd7ec53572d817d155be5b8a5b6aab7ebbdcb5a (patch) | |
tree | 5543319d12f175a80fbdc6b10e72788d91a0a623 /src/mysql/ngx_mysql.h | |
parent | a33fd634b0606f068ad39edd8374c035d353c590 (diff) | |
download | nginx-release-0.3.48.tar.gz nginx-release-0.3.48.zip |
nginx-0.3.48-RELEASE importrelease-0.3.48
*) Change: now the ngx_http_charset_module works for subrequests, if
the response has no "Content-Type" header line.
*) Bugfix: if the "proxy_pass" directive has no URI part, then the
"proxy_redirect default" directive add the unnecessary slash in
start of the rewritten redirect.
*) Bugfix: the internal redirect always transform client's HTTP method
to GET, now the transformation is made for the "X-Accel-Redirect"
redirects only and if the method is not HEAD; the bug had appeared
in 0.3.42.
*) Bugfix: the ngx_http_perl_module could not be built, if the perl was
built with the threads support; the bug had appeared in 0.3.46.
Diffstat (limited to 'src/mysql/ngx_mysql.h')
-rw-r--r-- | src/mysql/ngx_mysql.h | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/src/mysql/ngx_mysql.h b/src/mysql/ngx_mysql.h index 99f10396b..17cb1afba 100644 --- a/src/mysql/ngx_mysql.h +++ b/src/mysql/ngx_mysql.h @@ -11,26 +11,74 @@ #include <ngx_config.h> #include <ngx_core.h> #include <ngx_event.h> +#include <ngx_event_connect.h> -typedef struct { +typedef struct ngx_mysql_s ngx_mysql_t; + +typedef void (*ngx_mysql_handler_pt)(ngx_mysql_t *m); + + +struct ngx_mysql_s { ngx_peer_connection_t peer; -} ngx_mysql_t; + + ngx_buf_t *buf; + ngx_pool_t *pool; + + ngx_str_t *login; + ngx_str_t *passwd; + ngx_str_t *database; + + ngx_str_t query; + + ngx_uint_t pktn; + + ngx_mysql_handler_pt handler; + void *data; + ngx_int_t state; + +}; + + +#define NGX_MYSQL_CMDPKT_LEN 5 #if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED && 0) -#define ngx_m16toh(n) (*(uint32_t *) n & 0x0000ffff) -#define ngx_m24toh(n) (*(uint32_t *) n & 0x00ffffff) -#define ngx_m32toh(n) *(uint32_t *) n +#define ngx_m16toh(n) (*(uint32_t *) n & 0x0000ffff) +#define ngx_m24toh(n) (*(uint32_t *) n & 0x00ffffff) +#define ngx_m32toh(n) *(uint32_t *) n + +#define ngx_htom16(n, m) *(uint16_t *) n = (uint16_t) ((m) & 0xffff) + +#define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \ + (n)[1] = (u_char) (((m) >> 8) & 0xff); \ + (n)[2] = (u_char) (((m) >> 16) & 0xff) + +#define ngx_htom32(n, m) *(uint32_t *) (n) = (m) #else -#define ngx_m16toh(n) (n[0] | n[1] << 8) -#define ngx_m24toh(n) (n[0] | n[1] << 8 | n[2] << 16) -#define ngx_m32toh(n) (n[0] | n[1] << 8 | n[2] << 16 | n[3] << 24) +#define ngx_m16toh(n) (n[0] | n[1] << 8) +#define ngx_m24toh(n) (n[0] | n[1] << 8 | n[2] << 16) +#define ngx_m32toh(n) (n[0] | n[1] << 8 | n[2] << 16 | n[3] << 24) + +#define ngx_htom16(n, m) (n)[0] = (u_char) (m); (n)[1] = (u_char) ((m) >> 8) + +#define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \ + (n)[1] = (u_char) (((m) >> 8) & 0xff); \ + (n)[2] = (u_char) (((m) >> 16) & 0xff) + +#define ngx_htom32(n, m) (n)[0] = (u_char) ((m) & 0xff); \ + (n)[1] = (u_char) (((m) >> 8) & 0xff); \ + (n)[2] = (u_char) (((m) >> 16) & 0xff); \ + (n)[3] = (u_char) (((m) >> 24) & 0xff) #endif +ngx_int_t ngx_mysql_connect(ngx_mysql_t *m); +ngx_int_t ngx_mysql_query(ngx_mysql_t *m); + + #endif /* _NGX_MYSQL_H_INCLUDED_ */ |