Bug #5765 error in mysql_fetch_field() and mysql_fetch_fields()

Submitted: 27 Sep 2004 15:23 Modified: 6 Nov 2004 11:08
Reporter: Salvatore Sorrentino Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:MacOS (OS X)
Assigned to: Assigned Account CPU Architecture:Any

[27 Sep 2004 15:23] Salvatore Sorrentino
Description:
When using mysql_fetch_fields(), the the client lib skips every other field in the array, eventually 
causing a memory access error. When using mysql_fetch_field() the field_type does not report 
correctly.

How to repeat:
//if (fieldNames) [fieldNames release];
unsigned cnt = mysql_num_fields(res);
field = mysql_fetch_fields(res);
unsigned j;
myFields = malloc_zone_malloc(mallocZone, sizeof(int) * cnt);
myFields = malloc(sizeof(int) * cnt);
//unsigned cntr = 0;
//fieldNames = [[NSMutableArray alloc] initWithCapacity:cnt];
for(i = 0; i < cnt; i++)
{
	//NSString *name = [[NSString alloc]  initWithCString:field[i].name];
	myFields[i] = field[i].type;
	printf("Field %u = %s, type = %i" , i, field[i].name, myFields[i]);
	//[fieldNames addObject:name];
	//[name release];
}

Suggested fix:
??
[6 Oct 2004 11:08] Hartmut Holzgraefe
Can you please provide a complete compilable example that
shows the problem and make sure that this is not a problem 
in your code?
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.