Solved

Mysql c api doubt

Posted on 2004-03-20
1
264 Views
Last Modified: 2010-04-15
Hi experts,

       I am writing a c program using mysql api. My mysql program is returning the output like


 col1          col2                    col3                  col4                                            col5

 
  1  ||    20040319092354 ||    37   ||    Application Error Notification    ||       Relevant line :<META

  2  ||    20040319092356 ||    30   ||    Application Error note            ||       Relevant line2 :<META


and so  on upto 'n' rows..........




I want the output to be in form


col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)
col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)


thus 30 rows........

Please give me idea ( preferrably code snippet) to do this......
Early responses are greatly appreciated.....


Warm regards

NP

0
Comment
Question by:msanoop
1 Comment
 
LVL 9

Accepted Solution

by:
ankuratvb earned 250 total points
ID: 10642998
Borrowing code from ur other thread:

if (result = mysql_store_result(mysql))
   {
      for(r=0;r<=mysql_field_count(mysql);r++)
       {
          row=mysql_fetch_row(result);
          if(row<0) break;
          for(t=0;t<mysql_num_fields(result);t++)
            {
                  printf("Col:%d:::%s  ",t+1,row[t]);
            }
          printf("\n");
       }
    }
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now