[Mysql Api] Problem with tables listing
- From: kilian <comp-os.50.nsd@xxxxxxxxxxxxxxx>
- Date: Wed, 08 Jun 2005 22:12:55 +0200
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[i]);
}/****************************************/
Thanks.... .
- Follow-Ups:
- Re: [Mysql Api] Problem with tables listing
- From: CBFalconer
- Re: [Mysql Api] Problem with tables listing
- From: SM Ryan
- Re: [Mysql Api] Problem with tables listing
- Prev by Date: Re: transfer from ASCII to int
- Next by Date: Re: trouble in freeing memory using realloc
- Previous by thread: Array problem
- Next by thread: Re: [Mysql Api] Problem with tables listing
- Index(es):
Relevant Pages
|