diff options
author | Brian Cully <bjc@kublai.com> | 2008-03-01 15:54:16 -0500 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2008-03-01 15:54:16 -0500 |
commit | 172b5f0aef9e49e3c4af4f6c8a4077aef833b7f3 (patch) | |
tree | ffae6652bad4f1bc3184762c5dc443a700f26db6 /src | |
parent | 0c021f75dd5676e642436092da908223f28b4c61 (diff) | |
download | mysqlerl-172b5f0aef9e49e3c4af4f6c8a4077aef833b7f3.tar.gz mysqlerl-172b5f0aef9e49e3c4af4f6c8a4077aef833b7f3.zip |
Use a switch dispatch and crash on unknown types.
Diffstat (limited to 'src')
-rw-r--r-- | src/mysqlerl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mysqlerl.c b/src/mysqlerl.c index 0f88a49..dfd7ef0 100644 --- a/src/mysqlerl.c +++ b/src/mysqlerl.c @@ -175,8 +175,16 @@ write_cmd(const char *cmd, msglen_t len) void dispatch_db_cmd(MYSQL *dbh, msg_t *msg) { - logmsg("DEBUG: type: %d, msg: %s.", msg->type, msg->msg); - write_cmd(msg->msg, msg->msglen); + switch (msg->type) { + case QUERY_MSG: + logmsg("DEBUG: got query msg: %s.", msg->msg); + write_cmd(msg->msg, msg->msglen); + break; + + default: + logmsg("WARNING: message type %d unknown.", msg->type); + exit(3); + } } void |