Issue information

Issue ID
#4267
Status
Unable to Reproduce
Severity
None
Started
Hercules Elf Bot
May 29, 2010 18:54
Last Post
Hercules Elf Bot
Jun 23, 2012 9:23
Confirmation
N/A

Hercules Elf Bot - May 29, 2010 18:54

Originally posted by [b]shazeya[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4267

This error dates back beyond 14312. I saw that in all 143xx and late 142xx.

The error: [SQL]: DB error - Incorrect arguments to mysqld_stmt_execute \ [Debug]: at account_sql.c:634...

To reproduce and identify the error:
1. Clean up and build all:
CODE
$ make clean && make all

2. Run Athena SQL:
CODE
$ ./start

3. Clean up and build sql:
CODE
$ make clean && make sql && make conf
The last is meant to get rid of another runtime error due to the absence of conf/import and save (ref: my other bug report).
4. Run Athena SQL:
CODE
$ ./start


The error is traced to:
CODE
    {// update account table
        if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`level`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  0, SQLDT_STRING, (void*)acc->userid,           strlen(acc->userid))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  1, SQLDT_STRING, (void*)acc->pass,             strlen(acc->pass))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  2, SQLDT_ENUM,   (void*)&acc->sex,             sizeof(acc->sex))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  3, SQLDT_STRING, (void*)acc->email,            strlen(acc->email))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  4, SQLDT_INT,    (void*)&acc->level,           sizeof(acc->level))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  5, SQLDT_UINT,   (void*)&acc->state,           sizeof(acc->state))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  6, SQLDT_LONG,   (void*)&acc->unban_time,      sizeof(acc->unban_time))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  7, SQLDT_LONG,   (void*)&acc->expiration_time, sizeof(acc->expiration_time))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  8, SQLDT_UINT,   (void*)&acc->logincount,      sizeof(acc->logincount))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  9, SQLDT_STRING, (void*)&acc->lastlogin,       strlen(acc->lastlogin))
        ||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->last_ip,         strlen(acc->last_ip))
        ||  SQL_SUCCESS != SqlStmt_Execute(stmt)
        ) {
            SqlStmt_ShowDebug(stmt);
            break;
        }
    }

Line 634 is SqlStmt_ShowDebug(stmt);. The offending line is actually 620. I am no MySQL expert but that UPDATE query looks badly constructed if at all correct. Please correct me if I got it wrong, that ? is not a string in MySQL and probably not in C either. The correct query should be of the format UPDATE `table` SET `field`='string' WHERE `field`='string';

Please verify and take action. Or correct me.

Hercules Elf Bot - Dec 8, 2011 16:59

Originally posted by [b]Ind[/b]
I can't reproduce it, the construction is OK it follows SqlStmt_Prepare pattern