| Bug #1185 | mysql_bind_param ignore buffer length for DATA,TIME,DATETIME causes problem | ||
|---|---|---|---|
| Submitted: | 2 Sep 2003 20:33 | Modified: | 22 Sep 2003 22:03 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 4.1.0-alpha-max-nt | OS: | Windows (Windows2000) |
| Assigned to: | Venu Anuganti | CPU Architecture: | Any |
[22 Sep 2003 22:03]
Venu Anuganti
Hi !! Thanks for the bug report, and this is fixed now in the current BK source tree. The reason for this is that, the code is kept as it is even after MYSQL_TIME is introduced, as the original version use to handle all DATE, TIME and TS in string format. Anyway, as they are handled separately now after MYSQL_TIME is introduced, the buffer_length must be taken care as constant sizeof(MYSQL_TIME). Thanks Venu

Description: I want to use mysql_prepare() function in my project,so i downloaded the source files mysql-4.1.0-alpha-src.zip, modified libmysql.def to export relate functions,complied libmysql successfully.But, When i run my project, mysql_execute() return message "mysql client run out of memory".The problem is caused by uninitialized buffer length on fields which have MYSQL_DATETIME type. In function mysql_bind_param(), it ignore buffer length for DATA,TIME,DATATIME,but in function store_param(), it check this value in function my_realloc_str() and return error from here. How to repeat: Just use mysql_prepare with MYSQL_DATETIME fields. Suggested fix: In function mysql_bind_param, set the buffer length to the size of MYSQL_TIME,like this: case MYSQL_TYPE_TIMESTAMP: param->store_param_func= store_param_datetime; param->buffer_length= sizeof(MYSQL_TIME); // set the buffer length break; This resolve my problem.