comparison src/mysql/ngx_mysql.h @ 653:7cbef16c71a1 release-0.3.48

nginx-0.3.48-RELEASE import *) 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.
author Igor Sysoev <igor@sysoev.ru>
date Mon, 29 May 2006 17:28:12 +0000
parents 4946078f0a79
children d620f497c50f
comparison
equal deleted inserted replaced
652:d01fc553611d 653:7cbef16c71a1
9 9
10 10
11 #include <ngx_config.h> 11 #include <ngx_config.h>
12 #include <ngx_core.h> 12 #include <ngx_core.h>
13 #include <ngx_event.h> 13 #include <ngx_event.h>
14 #include <ngx_event_connect.h>
14 15
15 16
16 typedef struct { 17 typedef struct ngx_mysql_s ngx_mysql_t;
18
19 typedef void (*ngx_mysql_handler_pt)(ngx_mysql_t *m);
20
21
22 struct ngx_mysql_s {
17 ngx_peer_connection_t peer; 23 ngx_peer_connection_t peer;
18 } ngx_mysql_t; 24
25 ngx_buf_t *buf;
26 ngx_pool_t *pool;
27
28 ngx_str_t *login;
29 ngx_str_t *passwd;
30 ngx_str_t *database;
31
32 ngx_str_t query;
33
34 ngx_uint_t pktn;
35
36 ngx_mysql_handler_pt handler;
37 void *data;
38 ngx_int_t state;
39
40 };
41
42
43 #define NGX_MYSQL_CMDPKT_LEN 5
19 44
20 45
21 #if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED && 0) 46 #if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED && 0)
22 47
23 #define ngx_m16toh(n) (*(uint32_t *) n & 0x0000ffff) 48 #define ngx_m16toh(n) (*(uint32_t *) n & 0x0000ffff)
24 #define ngx_m24toh(n) (*(uint32_t *) n & 0x00ffffff) 49 #define ngx_m24toh(n) (*(uint32_t *) n & 0x00ffffff)
25 #define ngx_m32toh(n) *(uint32_t *) n 50 #define ngx_m32toh(n) *(uint32_t *) n
51
52 #define ngx_htom16(n, m) *(uint16_t *) n = (uint16_t) ((m) & 0xffff)
53
54 #define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \
55 (n)[1] = (u_char) (((m) >> 8) & 0xff); \
56 (n)[2] = (u_char) (((m) >> 16) & 0xff)
57
58 #define ngx_htom32(n, m) *(uint32_t *) (n) = (m)
26 59
27 #else 60 #else
28 61
29 #define ngx_m16toh(n) (n[0] | n[1] << 8) 62 #define ngx_m16toh(n) (n[0] | n[1] << 8)
30 #define ngx_m24toh(n) (n[0] | n[1] << 8 | n[2] << 16) 63 #define ngx_m24toh(n) (n[0] | n[1] << 8 | n[2] << 16)
31 #define ngx_m32toh(n) (n[0] | n[1] << 8 | n[2] << 16 | n[3] << 24) 64 #define ngx_m32toh(n) (n[0] | n[1] << 8 | n[2] << 16 | n[3] << 24)
65
66 #define ngx_htom16(n, m) (n)[0] = (u_char) (m); (n)[1] = (u_char) ((m) >> 8)
67
68 #define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \
69 (n)[1] = (u_char) (((m) >> 8) & 0xff); \
70 (n)[2] = (u_char) (((m) >> 16) & 0xff)
71
72 #define ngx_htom32(n, m) (n)[0] = (u_char) ((m) & 0xff); \
73 (n)[1] = (u_char) (((m) >> 8) & 0xff); \
74 (n)[2] = (u_char) (((m) >> 16) & 0xff); \
75 (n)[3] = (u_char) (((m) >> 24) & 0xff)
32 76
33 #endif 77 #endif
34 78
35 79
80 ngx_int_t ngx_mysql_connect(ngx_mysql_t *m);
81 ngx_int_t ngx_mysql_query(ngx_mysql_t *m);
82
83
36 #endif /* _NGX_MYSQL_H_INCLUDED_ */ 84 #endif /* _NGX_MYSQL_H_INCLUDED_ */