Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
mxq
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
20
Pull requests
3
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
b636630
helper
manpages
mysql
web
.gitignore
.vimrc
Doxyfile
LICENSE
Makefile
README.md
keywordset.c
keywordset.h
mx_flock.c
mx_flock.h
mx_getopt.c
mx_getopt.h
mx_log.c
mx_log.h
mx_mysql.c
mx_mysql.h
mx_proc.c
mx_proc.h
mx_util.c
mx_util.h
mxq.h
mxq_daemon.c
mxq_daemon.h
mxq_group.c
mxq_group.h
mxq_job.c
mxq_job.h
mxq_log.c
mxq_reaper.c
mxqadmin.c
mxqd.c
mxqd.h
mxqd_control.c
mxqd_control.h
mxqdctl-hostconfig.sh
mxqdump.c
mxqkill.c
mxqps.c
mxqset.c
mxqsub.c
os-release
parser.y
ppidcache.c
ppidcache.h
test_keywordset.c
test_mx_log.c
test_mx_mysql.c
test_mx_util.c
test_mxqd_control.c
test_parser.c
xmalloc.h
Breadcrumbs
mxq
/
test_mx_mysql.c
Blame
Blame
Latest commit
History
History
97 lines (63 loc) · 2.45 KB
Breadcrumbs
mxq
/
test_mx_mysql.c
Top
File metadata and controls
Code
Blame
97 lines (63 loc) · 2.45 KB
Raw
#include <assert.h> #include <errno.h> #include "mx_log.h" #include "mx_mysql.h" int main(int argc, char *argv[]) { struct mx_mysql *mysql = NULL; struct mx_mysql_stmt *stmt = NULL; uint64_t group_id = 444; uint64_t group_id1 = 1234; uint64_t group_id2 = 123; char *group_name = NULL; unsigned long long int count; int res; mx_log_level_set(MX_LOG_DEBUG); mx_log_debug("group_id = %d", group_id); mx_log_debug("group_id2 = %d", group_id2); res = mx_mysql_connect(&mysql); assert(res == 0); //res = mx_mysql_connect(mysql); //assert(res == 0); stmt = mx_mysql_statement_prepare(mysql, "SELECT group_id, group_id, group_name FROM mxq_group where group_id = ?"); assert(stmt); mx_log_debug("field_count = %d", mx_mysql_statement_field_count(stmt)); mx_log_debug("param_count = %d", mx_mysql_statement_param_count(stmt)); res = mx_mysql_statement_param_bind(stmt, 0, uint64, &group_id); assert(res == 0); res = mx_mysql_statement_execute(stmt, &count); assert(res == 0); res = mx_mysql_statement_result_bind(stmt, 0, uint64, &group_id1); assert(res == 0); res = mx_mysql_statement_result_bind(stmt, 1, uint64, &group_id2); assert(res == 0); res = mx_mysql_statement_result_bind(stmt, 2, string, &group_name); assert(res == 0); //mx_mysql_statement_param_bind(stmt, 0, uint64, &group_id); res = mx_mysql_statement_fetch(stmt); assert(res == 0); mx_log_debug("mx_mysql_statement_fetch(): %s", mx_mysql_error()); mx_log_debug("&group_name = 0x%x", &group_name); mx_log_debug("group_name = %s", group_name); //#define debug_value(fmt, v) mx_log_debug("debug_value: " #v " = " fmt, v) //debug_value("%d", stmt->result.data[0].length); mx_debug_value("%d", stmt->result.data[2].length); mx_debug_value("0x%x", stmt->result.data[2].string_ptr); mx_debug_value("%s", *(stmt->result.data[2].string_ptr)); mx_log_debug("group_id = %d", group_id); mx_log_debug("group_id2 = %d", group_id2); // assert(res == -ERANGE); // assert(group_id2 == 188); // truncated assert(res == 0); assert(group_id2 == group_id); res = mx_mysql_statement_fetch(stmt); assert(res == 0); res = mx_mysql_statement_fetch(stmt); assert(res == 0); res = mx_mysql_statement_close(&stmt); assert(res == 0); res = mx_mysql_finish(&mysql); assert(res == 0); mx_free_null(group_name); return 0; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
You can’t perform that action at this time.