2 messages in com.mysql.lists.pluspluscore dump in mysql_bind_param (versio...
FromSent OnAttachments
Kevin Cowley27 Apr 2004 02:26 
Sinisa Milivojevic03 May 2004 04:46 
Subject:core dump in mysql_bind_param (versions 4.1.1-alpha, 5.0.0-alpha, 4.1.2-alpha-nightly)
From:Kevin Cowley (kevi@alchemetrics.co.uk)
Date:04/27/2004 02:26:34 AM
List:com.mysql.lists.plusplus

I'm not sure if this is the right list to post this to as this is a C problem and not a C++ problem and nobody on the general list has bothered to reply there.

I'm getting a core dump in mysql_bind_params which I need help in identifying why. The manual is no use as the 4.1.1 API actual quotes the (as yet) unimplemented 5.0.0 interface which is not what is currently in the 4.1.1-alpha 4.1.2-apha-nightly or 5.0.0-alpha sources.

Begin code Block

sprintf(query,"INSERT INTO ssa_keys (urn,key_address,addr_part1,addr_part2,postcode) Values(?,?,?,?,?)"); if ((stmt=mysql_prepare(conn,query, strlen(query))==NULL)) { fprintf(stderr, "mysql_stmt_prepare error with \"%s\": %s", query, mysql_stmt_error(stmt)); return EXIT_SQL_FAIL; } /* bind the data buffers */

/* urn */ bind_vars[BIND_IV1_URN].buffer_type=MYSQL_TYPE_LONG; bind_vars[BIND_IV1_URN].buffer=(char *)&vUrnField; bind_vars[BIND_IV1_URN].is_null=0; /* key_address */ bind_vars[BIND_IV1_KEY].buffer_type=MYSQL_TYPE_STRING; bind_vars[BIND_IV1_KEY].buffer=bfKeyField; bind_vars[BIND_IV1_KEY].buffer_length=szKeyField; bind_vars[BIND_IV1_KEY].is_null=0; bind_vars[BIND_IV1_KEY].length=&lnKeyField; /* addr_part1 */ bind_vars[BIND_IV1_ADDR1].buffer_type=MYSQL_TYPE_STRING; bind_vars[BIND_IV1_ADDR1].buffer=bfAddr1Field; bind_vars[BIND_IV1_ADDR1].buffer_length=szAddr1Field; bind_vars[BIND_IV1_ADDR1].is_null=&is_addr1_null; bind_vars[BIND_IV1_ADDR1].length=&lnAddr1Field; /* addr_part2 */ bind_vars[BIND_IV1_ADDR2].buffer_type=MYSQL_TYPE_STRING; bind_vars[BIND_IV1_ADDR2].buffer=bfAddr2Field; bind_vars[BIND_IV1_ADDR2].buffer_length=szAddr2Field; bind_vars[BIND_IV1_ADDR2].is_null=&is_addr2_null; bind_vars[BIND_IV1_ADDR2].length=&lnAddr2Field; /* postcode */ bind_vars[BIND_IV1_PCODE].buffer_type=MYSQL_TYPE_STRING; bind_vars[BIND_IV1_PCODE].buffer=bfPcodeField; bind_vars[BIND_IV1_PCODE].buffer_length=szPcodeField; bind_vars[BIND_IV1_PCODE].is_null=&is_pcode_null; bind_vars[BIND_IV1_PCODE].length=&lnPcodeField;

if (mysql_bind_param(stmt,bind_vars)) { fprintf(stderr, "mysql_stmt_bind_param error: %s", mysql_stmt_error(stmt)); return EXIT_SQL_FAIL; }

End code block

Prior to this I use a standard query as follows to create the tables with no problems

create table ssa_keys(urn int unsigned not null, key_address binary(8) not null, addr_part1 char(40) null, addr_part2 char(40) null, postcode char(8) null);

A standard insert query works without problems but we want to convert this to parsed/compiled query for speed.

We're running on SLES8 using gcc 3.2.2