diff -r 06eb2850703f -r 3aa8a37a3dd8 dbd/mysql/statement.c --- a/dbd/mysql/statement.c Mon Dec 01 02:56:40 2008 +0000 +++ b/dbd/mysql/statement.c Mon Dec 01 07:22:44 2008 +0000 @@ -59,6 +59,7 @@ MYSQL_RES *metadata = NULL; char *error_message = NULL; + char *errstr = NULL; int p; @@ -72,7 +73,7 @@ if (expected_params != num_bind_params) { /* - * mysql_stmt_bind_param does not handle this conndition, + * mysql_stmt_bind_param does not handle this condition, * and the client library will segfault if these do no match */ lua_pushboolean(L, 0); @@ -91,6 +92,7 @@ size_t *str_len = NULL; double *num = NULL; int *boolean = NULL; + char err[64]; switch(type) { case LUA_TNIL: @@ -132,7 +134,9 @@ break; default: - error_message = DBI_ERR_BINDING_UNKNOWN; + snprintf(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); + errstr = err; + error_message = DBI_ERR_BINDING_PARAMS; goto cleanup; } } @@ -175,7 +179,7 @@ if (error_message) { lua_pushboolean(L, 0); - lua_pushfstring(L, error_message, mysql_stmt_error(statement->stmt)); + lua_pushfstring(L, error_message, errstr ? errstr : mysql_stmt_error(statement->stmt)); return 2; }