Mohsen,

The data structure you seem to be looking for is MYSQL_RES, the C API resultset, which is an array & which is described in the manual page you were pointed to. It's pretty straightforward to use, eg

...
MYSQL_RES *rset;
...

if( mysql_real_query( conn, qry, strlen( qry ) == MYSQL_TRUE ) {
 if(( rset = mysql_store_result( conn )) != NULL ) {
   cols = mysql_num_fields( rset );
   rows = (long) mysql_num_rows( rset );
...etc...

PB

-----

Mohsen Pahlevanzadeh wrote:

Dears,I was attempping with your code.But it could't do my job.
My job:
I have list of my tables in my DB,i did it with mysql_list_tables() func.
It returns MYSQL_RES type.But i don't know how to split it to an array.
Please guide me......


Hi,

I think you can find all the information you are looking for there:
http://dev.mysql.com/doc/mysql/en/c.html
You have a description of all the functions :
http://dev.mysql.com/doc/mysql/en/c-api-functions.html

For example:
http://dev.mysql.com/doc/mysql/en/mysql-fetch-row.html

MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;
num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
  unsigned long *lengths;
  lengths = mysql_fetch_lengths(result);
  for(i = 0; i < num_fields; i++)
  {
      printf("[%.*s] ", (int) lengths[i], row[i] ? row[i] : "NULL");
  }
  printf("\n");
}



Maybe this is a good start point for you!




From: "Mohsen Pahlevanzadeh" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Subject: MYSQL_RES & ......
Date: Fri, 18 Feb 2005 16:44:06 -0800 (PST)

Dears,mysql_list_tables returns name of tables.(tables of a DB)
It returns MYSQL_RES type.
I want to split it to an array.
I'm newbie in SQL,Please guide me.....
I'm working C.
yours,Mohsen

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



_________________________________________________________________
Want to block unwanted pop-ups? Download the free MSN Toolbar now!
http://toolbar.msn.co.uk/










--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 2/18/2005


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to