K
kilian
Hello,
I posted this message in alt.comp.databases.mysql but I fear that very
few peoples are visiting this newsgroup at this time...
So I rewrite my message here:
I'm a newbie with the C API (I program under Debian Sarge with Gcc-3.3.5)
I have a database which called "loges" and I would like to list the
tables in the shell's output (with printf).
Like that:
table1
table2
table3
But on the output I just get that:
tables_in_loges
I don't know where is my error...
Here is my source:
/*******************************/
MYSQL mysql_handle;
MYSQL_FIELD *tables;
MYSQL_RES *result;
unsigned int nb_tables;
mysql_init(&mysql_handle);
// login_datas is a structure with my username, password etc...
if(!mysql_real_connect(&mysql_handle,login_datas.host,login_datas.
user,login_datas.password,login_datas.database,3386,NULL,0))
{
printf("Erreur1\n");
}
result=mysql_list_tables(&mysql_handle,NULL);
if (result==NULL){
printf("Error2\n");
}
if (result)
{
nb_tables=mysql_num_fields(result);
}
tables=mysql_fetch_fields(result);
for (i=0;i<nb_tables;i++)
{
printf("%s\n",tables);
}
/****************************************/
Thanks....
I posted this message in alt.comp.databases.mysql but I fear that very
few peoples are visiting this newsgroup at this time...
So I rewrite my message here:
I'm a newbie with the C API (I program under Debian Sarge with Gcc-3.3.5)
I have a database which called "loges" and I would like to list the
tables in the shell's output (with printf).
Like that:
table1
table2
table3
But on the output I just get that:
tables_in_loges
I don't know where is my error...
Here is my source:
/*******************************/
MYSQL mysql_handle;
MYSQL_FIELD *tables;
MYSQL_RES *result;
unsigned int nb_tables;
mysql_init(&mysql_handle);
// login_datas is a structure with my username, password etc...
if(!mysql_real_connect(&mysql_handle,login_datas.host,login_datas.
user,login_datas.password,login_datas.database,3386,NULL,0))
{
printf("Erreur1\n");
}
result=mysql_list_tables(&mysql_handle,NULL);
if (result==NULL){
printf("Error2\n");
}
if (result)
{
nb_tables=mysql_num_fields(result);
}
tables=mysql_fetch_fields(result);
for (i=0;i<nb_tables;i++)
{
printf("%s\n",tables);
}
/****************************************/
Thanks....