Hai all,
I am haranath and very much new to Mysql database.I have to insert
fingerprint(binary) data in to mysql database.Here i am doing by using
C API's of mysql.This is my code.Any mistakes please correct me.
mysql_samp.c

#include
#include
#include
#include */needed by mysql C api's/*
int main(void)
{
int i;
//mysql variables

MYSQL *mysql;
FILE *flag;
MYSQL_RES *results;
MYSQL_ROW record;
unsigned char C[255];
char InsQuery[1024];

//opening a file which contains fingerprint data
flag =fopen("/home/haranath/mysql/mysql_samples/hara","rb");
if(flag!=NULL)
{
i=fread(C,1,1,flag);
fclose(flag);
}
else{
exit(1);
}
//Initialaisation of mysql client

mysql = mysql_init(NULL);
//connecting to mysql client

mysql_real_connect(mysql,NULL,NULL,NULL,"biometric",0,NULL,0);

//formating the query with my data

sprintf(InsQuery,"insert into user_info
values(1,'%s','%s','%s',0,0,'fp1','fp2');","hara",C,C);
mysql_query(mysql,InsQuery);
mysql_query(mysql,"select * from user_info");
results = mysql_store_result(mysql);
while((record = mysql_fetch_row(results))) {
printf("%s, %s, %s, %s, %s, %s, %s,
%s\n",record[0],record[1],record[2],record[3],record[4],
record[5],record[6],record[7]);
}
mysql_free_result(results);
mysql_close(mysql);
return 0;
}


Waiting for your Responses.

Thanking you.


WIth regards,

Haranath.T