Hi gleb,
I am including the packages which I tried to install along with the program
and the error I am getting when I tried running it.
Packages
MySQL-client-4.1.13-0.i386.rpm
MySQL-server-4.1.13-0.i386.rpm
MySQL-devel-4.1.13-0.i386.rpm
MySQL-shared-standard-4.1.13-0.rhel3.i386.rpm
The error I am getting for the below program is
Binding of columns failed
2036: Using unsupported buffer type: 0 (parameter: 1)
I tried running the program using the following command.
gcc -g prog_name -lmysqlclient
This is the program I am going to test.
#include <stdio.h>
#include <mysql/mysql.h>
#define INSERT "select column_name from information_schema WHERE Table_Name
= ?"
//This table is already existing. All the columns in the table are of type
varchar.
int main()
{
MYSQL mysql;
MYSQL_STMT *stmt;
MYSQL_BIND bind[1];
MYSQL_BIND bind_result[1];
char str_in[50], str[2];
unsigned long length[1];
unsigned long str_in_len;
my_bool is_null[1];
if(!mysql_init(&mysql))
{
exit(3);
}
if(!mysql_real_connect(&mysql, "localhost","user", "pass", "db", 0, NULL,
0))
{
printf("%d: %s \n",mysql_errno(&mysql), mysql_error(&mysql));
exit();
}
stmt = mysql_stmt_init(&mysql);
if(!stmt)
{
printf("Out of memory..\n");
exit(3);
}
if ( mysql_stmt_prepare(stmt, INSERT, strlen(INSERT)) )
{
printf("Prepare statement failed for insertion..:( \n");
exit(3);
}
bind[0].buffer_type = MYSQL_TYPE_VAR_STRING;
bind[0].buffer = (char *)str_in;
bind[0].buffer_length = 50;
bind[0].is_null = 0;
bind[0].length = &str_in_len;
strncpy(str_in, "information_schema", 50);
str_in_len = strlen(str_in);
if ( mysql_stmt_bind_param(stmt,bind) )
{
/*****Failing here ******/
printf("Binding of columns failed\n");
printf("%d: %s \n",mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
exit(3);
}
if (mysql_stmt_execute(stmt))
{
printf("Executing prepared statement failed\n");
exit(3);
}
memset(bind_result, 0, sizeof(bind_result));
bind_result[0].buffer_type = MYSQL_TYPE_STRING;
bind_result[0].buffer = (char *)str;
bind_result[0].buffer_length = 2;
bind_result[0].is_null = &is_null[0];
bind_result[0].length = &length[0];
if (mysql_stmt_bind_result(stmt, bind_result))
{
printf(" mysql_stmt_bind_result() failed\n");
printf(" %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Now buffer all results to client */
if (mysql_stmt_store_result(stmt))
{
printf(" mysql_stmt_store_result() failed\n");
printf(" %s\n", mysql_stmt_error(stmt));
exit(0);
}
while (!mysql_stmt_fetch(stmt))
{
if (is_null[0])
printf(" NULL\n");
else
printf(" %s(%ld)\n", str, length[0]);
}
printf("The no of rows affected are %d\n",mysql_stmt_affected_rows(stmt));
if (mysql_stmt_close(stmt))
{
printf("Error while closing mysql statement\n");
exit(3);
}
mysql_close(&mysql);
return 0;
}
Thank you
sujay
-----Original Message-----
From: Gleb Paharenko [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 11, 2005 2:58 PM
To: [email protected]
Subject: Re: Uninstalling the MySQL cleanly.
Hello.
I guess you have rpm installation, rpm -e should help you in this case.
Find installed mysql packets with `rpm -qa |grep -i mysql` command.
If you have troubles with making a choice, send the list of packets which
you got to the list.
Sujay Koduri <[EMAIL PROTECTED]> wrote:
>
>
>
>>
>> OS is RH9 and kernel is 2.4.20
>
> I suggest you send this to the MySQL list :-)
>
> With regards,
>>
>> > Can any one list the steps or give me any pointers how to cleanly
>> uninstall
>> > an upper version of MySQL,
>> > so that after wards if we install lower version it should not be
>> > affected
>> by
>> > any left overs of the previous installation.
>>
>> What OS?
>>
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]